Class SortedList<E>
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- javafx.collections.ObservableListBase<E>
-
- javafx.collections.transformation.TransformationList<E,E>
-
- javafx.collections.transformation.SortedList<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>, Observable, ObservableList<E>
public final class SortedList<E> extends TransformationList<E,E>
Since:
JavaFX 8.0
See Also:
-
Property Summary
All MethodsInstance MethodsConcrete Methods Type Property and Description ObjectProperty<Comparator<? super E>>comparatorThe comparator that denotes the order of this SortedList.
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor and Description SortedList(ObservableList<? extends E> source)Constructs a new unordered SortedList wrapper around the source list.SortedList(ObservableList<? extends E> source, Comparator<? super E> comparator)Creates a new SortedList wrapped around the source list.
-
Method Summary
All MethodsInstance MethodsConcrete Methods Modifier and Type Method and Description ObjectProperty<Comparator<? super E>>comparatorProperty()The comparator that denotes the order of this SortedList.Eget(int index)Returns the element at the specified position in this list.Comparator<? super E>getComparator()Gets the value of the property comparator.intgetSourceIndex(int index)Maps the index of this list's element to an index in the direct source list.voidsetComparator(Comparator<? super E> comparator)Sets the value of the property comparator.intsize()Returns the number of elements in this list.protected voidsourceChanged(ListChangeListener.Change<? extends E> c)Called when a change from the source is triggered.-
Methods inherited from class javafx.collections.transformation.TransformationList
getSource, getSourceIndexFor, isInTransformationChain
-
Methods inherited from class javafx.collections.ObservableListBase
addAll, addListener, addListener, beginChange, endChange, fireChange, hasListeners, nextAdd, nextPermutation, nextRemove, nextRemove, nextReplace, nextSet, nextUpdate, remove, removeAll, removeListener, removeListener, retainAll, setAll, setAll
-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javafx.collections.ObservableList
addAll, addListener, filtered, remove, removeAll, removeListener, retainAll, setAll, setAll, sorted, sorted
-
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, sort, spliterator, subList, toArray, toArray
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream
-
Methods inherited from interface javafx.beans.Observable
addListener, removeListener
-
-
Property Detail
-
comparator
public final ObjectProperty<Comparator<? super E>> comparatorProperty
The comparator that denotes the order of this SortedList. Null for unordered SortedList.See Also:
-
-
Constructor Detail
-
SortedList
public SortedList(ObservableList<? extends E> source, Comparator<? super E> comparator)Creates a new SortedList wrapped around the source list. The source list will be sorted using the comparator provided. If null is provided, the list stays unordered and is equal to the source list.Parameters:
source- a list to wrap
-
SortedList
public SortedList(ObservableList<? extends E> source)
Constructs a new unordered SortedList wrapper around the source list.Parameters:
source- the source list
-
-
Method Detail
-
sourceChanged
protected void sourceChanged(ListChangeListener.Change<? extends E> c)
Description copied from class:TransformationListCalled when a change from the source is triggered.Specified by:
sourceChangedin classTransformationList<E,E>Parameters:
c- the change
-
comparatorProperty
public final ObjectProperty<Comparator<? super E>> comparatorProperty()
The comparator that denotes the order of this SortedList. Null for unordered SortedList.See Also:
-
getComparator
public final Comparator<? super E> getComparator()
Gets the value of the property comparator.Property description:
The comparator that denotes the order of this SortedList. Null for unordered SortedList.
-
setComparator
public final void setComparator(Comparator<? super E> comparator)
Sets the value of the property comparator.Property description:
The comparator that denotes the order of this SortedList. Null for unordered SortedList.
-
get
public E get(int index)
Returns the element at the specified position in this list.Specified by:
getin classAbstractList<E>Parameters:
index- index of the element to returnReturns:
the element at the specified position in this list
Throws:
-
size
public int size()
Returns the number of elements in this list.Specified by:
sizein interfaceCollection<E>Specified by:
sizein classAbstractCollection<E>Returns:
the number of elements in this list
-
getSourceIndex
public int getSourceIndex(int index)
Description copied from class:TransformationListMaps the index of this list's element to an index in the direct source list.Specified by:
getSourceIndexin classTransformationList<E,E>Parameters:
index- the index in this listReturns:
the index of the element's origin in the source list
See Also:
-
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.