Spec-Zone.ru › OpenJavaFX 17

Class SortedList<E>

java.lang.Object
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>
Wraps an ObservableList and sorts its content. All changes in the ObservableList are propagated immediately to the SortedList. Note: invalid SortedList (as a result of broken comparison) doesn't send any notification to listeners on becoming valid again.
Since:
JavaFX 8.0
See Also:
TransformationList

Property Summary

Properties
Type Property Description
ObjectProperty<Comparator<? super E>> comparator
The comparator that denotes the order of this SortedList.

Field Summary

Fields declared in class java.util.AbstractList

modCount

Constructor Summary

Constructors
Constructor 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

Modifier and Type Method Description
ObjectProperty<Comparator<? super E>> comparatorProperty()
The comparator that denotes the order of this SortedList.
E get​(int index)
Returns the element at the specified position in this list.
Comparator<? super E> getComparator()
Gets the value of the property comparator.
void setComparator​(Comparator<? super E> comparator)
Sets the value of the property comparator.
int size()
Returns the number of elements in this list.

Methods declared in class javafx.collections.transformation.TransformationList

getSource, getSourceIndex, getSourceIndexFor, getViewIndex, isInTransformationChain, sourceChanged

Methods declared in class javafx.collections.ObservableListBase

beginChange, endChange, fireChange, hasListeners, nextAdd, nextPermutation, nextRemove, nextRemove, nextReplace, nextSet, nextUpdate

Methods declared in class java.util.AbstractList

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

Methods declared in class java.util.AbstractCollection

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

Methods declared in class java.lang.Object

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

Methods declared in interface java.util.Collection

parallelStream, removeIf, stream, toArray

Methods declared in interface java.lang.Iterable

forEach

Methods declared in 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 declared in interface javafx.beans.Observable

addListener, removeListener

Methods declared in interface javafx.collections.ObservableList

addAll, addListener, filtered, remove, removeAll, removeListener, retainAll, setAll, setAll, sorted, sorted

Property Details

comparator

public final ObjectProperty<Comparator<? super E>> comparatorProperty
The comparator that denotes the order of this SortedList. Null for unordered SortedList.
See Also:
getComparator(), setComparator(Comparator)

Constructor Details

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
comparator - a comparator to use or null for unordered List

SortedList

public SortedList(ObservableList<? extends E> source)
Constructs a new unordered SortedList wrapper around the source list.
Parameters:
source - the source list
See Also:
SortedList(javafx.collections.ObservableList, java.util.Comparator)

Method Details

comparatorProperty

public final ObjectProperty<Comparator<? super E>> comparatorProperty()
The comparator that denotes the order of this SortedList. Null for unordered SortedList.
See Also:
getComparator(), setComparator(Comparator)

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:
get in interface List<E>
Specified by:
get in class AbstractList<E>
Parameters:
index - index of the element to return
Returns:
the element at the specified position in this list
Throws:
IndexOutOfBoundsException

size

public int size()
Returns the number of elements in this list.
Specified by:
size in interface Collection<E>
Specified by:
size in interface List<E>
Specified by:
size in class AbstractCollection<E>
Returns:
the number of elements in this list

© 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.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API