# Class TransformationList<E,F>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
javafx.collections.ObservableListBase<E>
javafx.collections.transformation.TransformationList<E,F>

Type Parameters:
  `E` - the type parameter of this list
  `F` - the upper bound of the type of the source list

All Implemented Interfaces:
  `Iterable<E>, Collection<E>, List<E>, SequencedCollection<E>, Observable, ObservableList<E>`

Direct Known Subclasses:
  `FilteredList, SortedList`

public abstract class TransformationList<E,F> extends ObservableListBase<E>
A base class for all lists that wrap another list in a way that changes (transforms) the wrapped list's elements, order, size, or structure. If the source list is observable, a listener is automatically added to it and the events are delegated to `sourceChanged(javafx.collections.ListChangeListener.Change)`.

Since:
  JavaFX 8.0

- ## Field Summary

  ### Fields declared in class AbstractList

  `modCount`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `TransformationList(ObservableList<? extends F> source)`
  Creates a new Transformation list wrapped around the source list.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final ObservableList<? extends F>`
  `getSource()`
  The source list specified in the constructor of this transformation list.
  `abstract int`
  `getSourceIndex(int index)`
  Maps the index of this list's element to an index in the direct source list.
  `final int`
  `getSourceIndexFor(ObservableList<?> list, int index)`
  Maps the index of this list's element to an index of the provided `list`.
  `abstract int`
  `getViewIndex(int index)`
  Maps the index of the direct source list's element to an index in this list.
  `final boolean`
  `isInTransformationChain(ObservableList<?> list)`
  Checks whether the provided list is in the chain under this `TransformationList`.
  `protected abstract void`
  `sourceChanged(ListChangeListener.Change<? extends F> c)`
  Called when a change from the source is triggered.

  ### Methods declared in class ObservableListBase

  `addAll, addListener, addListener, beginChange, endChange, fireChange, hasListeners, nextAdd, nextPermutation, nextRemove, nextRemove, nextReplace, nextSet, nextUpdate, remove, removeAll, removeListener, removeListener, retainAll, setAll, setAll`

  ### Methods declared in class AbstractList

  `add, add, addAll, clear, equals, get, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList`

  ### Methods declared in class AbstractCollection

  `addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray, toArray, toString`

  ### Methods declared in class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods declared in interface Collection

  `parallelStream, removeIf, stream, toArray`

  ### Methods declared in interface Iterable

  `forEach`

  ### Methods declared in interface List

  `add, add, addAll, addAll, addFirst, addLast, clear, contains, containsAll, equals, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, set, size, sort, spliterator, subList, toArray, toArray`

  ### Methods declared in interface Observable

  `subscribe`

  ### Methods declared in interface ObservableList

  `filtered, replaceRange, sorted, sorted`

- ## Constructor Details

  - ### TransformationList

    protected TransformationList(ObservableList<? extends F> source)
    Creates a new Transformation list wrapped around the source list.
    Parameters:
      `source` - the wrapped list

- ## Method Details

  - ### getSource

    public final ObservableList<? extends F> getSource()
    The source list specified in the constructor of this transformation list.
    Returns:
      The List that is directly wrapped by this TransformationList

  - ### isInTransformationChain

    public final boolean isInTransformationChain(ObservableList<?> list)
    Checks whether the provided list is in the chain under this `TransformationList`. This means the list is either the direct source as returned by `getSource()` or the direct source is a `TransformationList`, and the list is in it's transformation chain.
    Parameters:
      `list` - the list to check
    Returns:
      true if the list is in the transformation chain as specified above.

  - ### sourceChanged

    protected abstract void sourceChanged(ListChangeListener.Change<? extends F> c)
    Called when a change from the source is triggered.
    Parameters:
      `c` - the change

  - ### getSourceIndex

    public abstract int getSourceIndex(int index)
    Maps the index of this list's element to an index in the direct source list.
    Parameters:
      `index` - the index in this list
    Returns:
      the index of the element's origin in the source list
    Throws:
      `IndexOutOfBoundsException` - if the index is out of range (`index < 0 || index >= size()`)
    See Also:
      - `getSource()`

  - ### getSourceIndexFor

    public final int getSourceIndexFor(ObservableList<?> list, int index)
    Maps the index of this list's element to an index of the provided `list`. The `list` must be in the transformation chain.
    Parameters:
      `list` - a list from the transformation chain
      `index` - the index of an element in this list
    Returns:
      the index of the element's origin in the provided list
    Throws:
      `IndexOutOfBoundsException` - if the index is out of range (`index < 0 || index >= size()`)
    See Also:
      - `isInTransformationChain(javafx.collections.ObservableList)`

  - ### getViewIndex

    public abstract int getViewIndex(int index)
    Maps the index of the direct source list's element to an index in this list.
    Parameters:
      `index` - the index in the source list
    Returns:
      the index of the element in this list if it is contained in this list or negative value otherwise
    Throws:
      `IndexOutOfBoundsException` - if the index is out of range (`index < 0 || index >= getSource().size()`)
    Since:
      9
    See Also:
      - `getSource()`
      - `getSourceIndex(int)`