Top Description Fields Constructors Methods
com.sun.javafx.collections

public Class ObservableListWrapper<E>

extends ModifiableObservableListBase<E>
implements SortableList<E>, RandomAccess
Class Inheritance
All Implemented Interfaces
java.util.RandomAccess, com.sun.javafx.collections.SortableList, javafx.collections.ObservableList, javafx.beans.Observable, java.util.List, java.util.SequencedCollection, java.util.Collection, java.lang.Iterable
Known Direct Subclasses
com.sun.javafx.collections.TrackableObservableList
Imports
java.util.BitSet, .Collection, .Comparator, .List, .Objects, .RandomAccess, com.sun.javafx.collections.NonIterableChange.SimplePermutationChange, javafx.beans.InvalidationListener, .Observable, javafx.collections.ModifiableObservableListBase, javafx.util.Callback

A List wrapper class that implements observability.

Field Summary

Modifier and TypeField and Description
private final List<E>
private final ElementObserver<E>
private SortHelper

Constructor Summary

AccessConstructor and Description
public
public
ObservableListWrapper(List<E> list, Callback<E, Observable[]> extractor)

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Overrides java.util.AbstractList.clear.

Implements java.util.List.clear, java.util.Collection.clear.

Removes all of the elements from this list (optional operation).

public boolean
contains(Object
element whose presence in this list is to be tested
o
)

Overrides java.util.AbstractCollection.contains.

Implements java.util.List.contains, java.util.Collection.contains.

Returns true if this list contains the specified element.

public boolean
containsAll(Collection<?>
collection to be checked for containment in this list
c
)

Overrides java.util.AbstractCollection.containsAll.

Implements java.util.List.containsAll, java.util.Collection.containsAll.

Returns true if this list contains all of the elements of the specified collection.

protected void
doAdd(int
the position where to add the element
index
,
E
the element that will be added
element
)

Implements abstract javafx.collections.ModifiableObservableListBase.doAdd.

Adds the element to the List at the position of index.

protected E
doRemove(int
the index of the removed element
index
)

Implements abstract javafx.collections.ModifiableObservableListBase.doRemove.

Removes the element at position of index.

protected E
doSet(int
the position where to set the element
index
,
E
the element that will be set at the specified position
element
)

Implements abstract javafx.collections.ModifiableObservableListBase.doSet.

Sets the element in the List at the position of index.

public void
doSort(Comparator<? super E>
the comparator for the sorting; never null
comparator
)

Implements com.sun.javafx.collections.SortableList.doSort.

Sorts the list and reports it as one change event.

public E
get(int
index of the element to return
index
)

Implements abstract javafx.collections.ModifiableObservableListBase.get.

Implements java.util.List.get.

Returns the element at the specified position in this list.

private SortHelper
public int
indexOf(Object
element to search for
o
)

Overrides java.util.AbstractList.indexOf.

Implements java.util.List.indexOf.

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

public int
lastIndexOf(Object
element to search for
o
)

Overrides java.util.AbstractList.lastIndexOf.

Implements java.util.List.lastIndexOf.

Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.

public void
remove(int
the start of the range to remove (inclusive)
fromIndex
,
int
the end of the range to remove (exclusive)
toIndex
)

Overrides javafx.collections.ObservableListBase.remove.

Implements javafx.collections.ObservableList.remove.

A simplified way of calling sublist(from, to).clear().

public boolean
removeAll(Collection<?>
collection containing elements to be removed from this list
c
)

Overrides javafx.collections.ModifiableObservableListBase.removeAll.

Implements java.util.List.removeAll, java.util.Collection.removeAll.

Removes from this list all of its elements that are contained in the specified collection (optional operation).

public boolean
retainAll(Collection<?>
collection containing elements to be retained in this list
c
)

Overrides javafx.collections.ModifiableObservableListBase.retainAll.

Implements java.util.List.retainAll, java.util.Collection.retainAll.

Retains only the elements in this list that are contained in the specified collection (optional operation).

public int
size()

Implements abstract javafx.collections.ModifiableObservableListBase.size.

Implements java.util.List.size, java.util.Collection.size.

Returns the number of elements in this list.

Inherited from javafx.collections.ModifiableObservableListBase:
addaddAlladdAllremoveremoveremoveRangesetsetAllsubList

Field Detail

backingListback to summary
private final List<E> backingList
elementObserverback to summary
private final ElementObserver<E> elementObserver
helperback to summary
private SortHelper helper

Constructor Detail

ObservableListWrapperback to summary
public ObservableListWrapper(List<E> list)
ObservableListWrapperback to summary
public ObservableListWrapper(List<E> list, Callback<E, Observable[]> extractor)

Method Detail

clearback to summary
public void clear()

Overrides java.util.AbstractList.clear.

Implements java.util.List.clear, java.util.Collection.clear.

Doc from java.util.List.clear.

Removes all of the elements from this list (optional operation). The list will be empty after this call returns.

Annotations
@Override
containsback to summary
public boolean contains(Object o)

Overrides java.util.AbstractCollection.contains.

Implements java.util.List.contains, java.util.Collection.contains.

Doc from java.util.List.contains.

Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that Objects.equals(o, e).

Parameters
o:Object

element whose presence in this list is to be tested

Returns:boolean

true if this list contains the specified element

Annotations
@Override
containsAllback to summary
public boolean containsAll(Collection<?> c)

Overrides java.util.AbstractCollection.containsAll.

Implements java.util.List.containsAll, java.util.Collection.containsAll.

Doc from java.util.List.containsAll.

Returns true if this list contains all of the elements of the specified collection.

Parameters
c:Collection<?>

collection to be checked for containment in this list

Returns:boolean

true if this list contains all of the elements of the specified collection

Annotations
@Override
doAddback to summary
protected void doAdd(int index, E element)

Implements abstract javafx.collections.ModifiableObservableListBase.doAdd.

Doc from javafx.collections.ModifiableObservableListBase.doAdd.

Adds the element to the List at the position of index.

For the description of possible exceptions, please refer to the documentation of add(java.lang.Object) method.

Parameters
index:int

the position where to add the element

element:E

the element that will be added

Annotations
@Override
doRemoveback to summary
protected E doRemove(int index)

Implements abstract javafx.collections.ModifiableObservableListBase.doRemove.

Doc from javafx.collections.ModifiableObservableListBase.doRemove.

Removes the element at position of index.

Parameters
index:int

the index of the removed element

Returns:E

the removed element

Annotations
@Override
doSetback to summary
protected E doSet(int index, E element)

Implements abstract javafx.collections.ModifiableObservableListBase.doSet.

Doc from javafx.collections.ModifiableObservableListBase.doSet.

Sets the element in the List at the position of index.

For the description of possible exceptions, please refer to the documentation of set(int, java.lang.Object) method.

Parameters
index:int

the position where to set the element

element:E

the element that will be set at the specified position

Returns:E

the old element at the specified position

Annotations
@Override
doSortback to summary
public void doSort(Comparator<? super E> comparator)

Implements com.sun.javafx.collections.SortableList.doSort.

Doc from com.sun.javafx.collections.SortableList.doSort.

Sorts the list and reports it as one change event.

Parameters
comparator:Comparator<? super E>

the comparator for the sorting; never null

Annotations
@Override
getback to summary
public E get(int index)

Implements abstract javafx.collections.ModifiableObservableListBase.get.

Implements java.util.List.get.

Doc from java.util.List.get.

Returns the element at the specified position in this list.

Parameters
index:int

index of the element to return

Returns:E

the element at the specified position in this list

Annotations
@Override
getSortHelperback to summary
private SortHelper getSortHelper()
indexOfback to summary
public int indexOf(Object o)

Overrides java.util.AbstractList.indexOf.

Implements java.util.List.indexOf.

Doc from java.util.List.indexOf.

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the lowest index i such that Objects.equals(o, get(i)), or -1 if there is no such index.

Parameters
o:Object

element to search for

Returns:int

the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element

Annotations
@Override
lastIndexOfback to summary
public int lastIndexOf(Object o)

Overrides java.util.AbstractList.lastIndexOf.

Implements java.util.List.lastIndexOf.

Doc from java.util.List.lastIndexOf.

Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the highest index i such that Objects.equals(o, get(i)), or -1 if there is no such index.

Parameters
o:Object

element to search for

Returns:int

the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element

Annotations
@Override
removeback to summary
public void remove(int fromIndex, int toIndex)

Overrides javafx.collections.ObservableListBase.remove.

Implements javafx.collections.ObservableList.remove.

Doc from javafx.collections.ObservableList.remove.

A simplified way of calling sublist(from, to).clear(). As this is a common operation, ObservableList has this method for convenient usage.

Parameters
fromIndex:int

the start of the range to remove (inclusive)

toIndex:int

the end of the range to remove (exclusive)

Annotations
@Override
removeAllback to summary
public boolean removeAll(Collection<?> c)

Overrides javafx.collections.ModifiableObservableListBase.removeAll.

Implements java.util.List.removeAll, java.util.Collection.removeAll.

Doc from java.util.List.removeAll.

Removes from this list all of its elements that are contained in the specified collection (optional operation).

Parameters
c:Collection<?>

collection containing elements to be removed from this list

Returns:boolean

true if this list changed as a result of the call

Annotations
@Override
retainAllback to summary
public boolean retainAll(Collection<?> c)

Overrides javafx.collections.ModifiableObservableListBase.retainAll.

Implements java.util.List.retainAll, java.util.Collection.retainAll.

Doc from java.util.List.retainAll.

Retains only the elements in this list that are contained in the specified collection (optional operation). In other words, removes from this list all of its elements that are not contained in the specified collection.

Parameters
c:Collection<?>

collection containing elements to be retained in this list

Returns:boolean

true if this list changed as a result of the call

Annotations
@Override
sizeback to summary
public int size()

Implements abstract javafx.collections.ModifiableObservableListBase.size.

Implements java.util.List.size, java.util.Collection.size.

Doc from java.util.List.size.

Returns the number of elements in this list. If this list contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this list

Annotations
@Override