Class AsynchronousMappedList<I,O>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
javafx.collections.ObservableListBase<E>
javafx.collections.ModifiableObservableListBase<T>
Type Parameters:
I - Input type.
O - Output type.
All Implemented Interfaces:
PermutableObservableList<O>, Iterable<O>, Collection<O>, List<O>, javafx.beans.Observable, javafx.collections.ObservableList<O>

public class AsynchronousMappedList<I,O> extends ObservableArrayList<O>
ObservableList that transforms elements from 'source' list on a background thread using potentially slow mappers. When a change is made to the source list, the change is reflected in this list at some time in the future. Changes to the list are made in the same order as they appear in the source list.
  • Property Details

    • mappingInProgress

      public javafx.beans.property.ReadOnlyProperty<Boolean> mappingInProgressProperty
  • Constructor Details

    • AsynchronousMappedList

      public AsynchronousMappedList(javafx.collections.ObservableList<I> pSourceList, Function<I,O> pMapper, Consumer<Runnable> pThreadScheduler)
    • AsynchronousMappedList

      public AsynchronousMappedList(javafx.collections.ObservableList<I> pSourceList, Function<I,S> pPreMapper, Function<S,T> pMapper, Function<T,O> pPostMapper, Consumer<Runnable> pThreadScheduler)
      Parameters:
      pPreMapper - Invoked on the JavaFX thread before scheduling a mapping task on a background thread. Can be used, for example, to transform mutable input element to immutable object.
      pMapper - Invoked on a background thread.
      pPostMapper - Invoked on the JavaFX thread after a mapping task is finished. Can be used, for example, to transform immutable intermediate object to mutable output element.
  • Method Details

    • getThreadScheduler

      public Consumer<Runnable> getThreadScheduler()
    • mappingInProgressProperty

      public javafx.beans.property.ReadOnlyProperty<Boolean> mappingInProgressProperty()
    • hasMappingInProgress

      public boolean hasMappingInProgress()
    • createDefaultThreadScheduler

      public static Consumer<Runnable> createDefaultThreadScheduler()
      Creates a default thread scheduler which executes the specified runnables in a single background thread in order of submission.