T - The type of the items, which are contained by the listpublic class SortedArrayList<T>
extends java.util.ArrayList<T>
ArrayList, which automatically keeps its items in a sorted order,
whenever new items are added. Such a list does not allow to add items at specific indices.
Therefore an UnsupportedOperationException is thrown by the add(int, Object) and addAll(int, Collection) methods.| Constructor and Description |
|---|
SortedArrayList()
Creates a new list, which automatically keeps its items in a sorted order, whenever new items
are added.
|
SortedArrayList(@NotNull java.util.Collection<? extends T> items)
Creates a new list, which automatically keeps its items in a sorted order, whenever new items
are added.
|
SortedArrayList(@NotNull java.util.Collection<? extends T> items,
@Nullable java.util.Comparator<? super T> comparator)
Creates a new list, which automatically keeps its items in a sorted order, whenever new items
are added.
|
SortedArrayList(@Nullable java.util.Comparator<? super T> comparator)
Creates a new list, which automatically keeps its items in a sorted order, whenever new items
are added.
|
SortedArrayList(int initialCapacity)
Creates a new list, which automatically keeps its items in a sorted order, whenever new items
are added.
|
SortedArrayList(int initialCapacity,
@Nullable java.util.Comparator<? super T> comparator)
Creates a new list, which automatically keeps its items in a sorted order, whenever new items
are added.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
T item) |
boolean |
add(T item) |
boolean |
addAll(@NotNull java.util.Collection<? extends T> items) |
boolean |
addAll(int index,
@NotNull java.util.Collection<? extends T> items) |
@Nullable java.util.Comparator<? super T> |
comparator()
Returns the comparator, which is used to sort the list's items.
|
clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizepublic SortedArrayList()
Comparable is used
to sort the list's items.public SortedArrayList(@NotNull
@NotNull java.util.Collection<? extends T> items)
Comparable is used
to sort the list's items.items - A collection, which contains the items, which should be added to the list, as an
instance of the type Collection or an empty list, if no items should be
addedpublic SortedArrayList(int initialCapacity)
Comparable is used
to sort the list's items.initialCapacity - The initial capacity of the list as an Integer valuepublic SortedArrayList(@Nullable
@Nullable java.util.Comparator<? super T> comparator)
comparator - The comparator, which should be used to sort the list's items, or null, if
the items' implementation of the interface Comparable should be
used insteadpublic SortedArrayList(@NotNull
@NotNull java.util.Collection<? extends T> items,
@Nullable
@Nullable java.util.Comparator<? super T> comparator)
items - A collection, which contains the items, which should be added to the list,
as an instance of the type Collection or an empty list, if no items
should be addedcomparator - The comparator, which should be used to sort the list's items, or null, if
the items' implementation of the interface Comparable should be
used insteadpublic SortedArrayList(int initialCapacity,
@Nullable
@Nullable java.util.Comparator<? super T> comparator)
initialCapacity - The initial capacity of the list as an Integer valuecomparator - The comparator, which should be used to sort the list's items, or
null, if the items' implementation of the interface Comparable
should be used instead@Nullable public @Nullable java.util.Comparator<? super T> comparator()
Comparator or null, if the item's implementation of the interface Comparable
is usedpublic boolean add(@NotNull
T item)
public void add(int index,
@NotNull
T item)
public boolean addAll(@NotNull
@NotNull java.util.Collection<? extends T> items)