E - type of elements in this setpublic class UnmodifiableSortedSet<E> extends ArraySet<E> implements SortedSet<E>
ArraySet.SetFullException_entries, MAX_CAPACITY| Constructor and Description |
|---|
UnmodifiableSortedSet(Collection<? extends E> c)Warning: O(n**2) |
UnmodifiableSortedSet(Collection<? extends E> c,
Comparator<? super E> comparator)Warning: O(n**2) |
UnmodifiableSortedSet(Set<? extends E> c)Copy of the given set, sorted. |
UnmodifiableSortedSet(Set<? extends E> c,
Comparator<? super E> comparator)Copy of the given set, sorted with the given comparator. |
UnmodifiableSortedSet(SortedSet<? extends E> c)Copy of the given sorted set. |
UnmodifiableSortedSet(SortedSet<? extends E> c,
Comparator<? super E> comparator)Copy of the given sorted set with the given comparator. |
| Modifier and Type | Method and Description |
|---|---|
boolean | add(E o)Add the element to the set. |
void | addUnique(E o)Unconditionally add o to the set. |
void | clear() |
Comparator<? super E> | comparator()Comparator used for ordering, or null. |
E | first()First (lowest) element. |
SortedSet<E> | headSet(E toElement) |
protected int | indexOf(Object o)Overridden to do binary search |
E | last()Last (highest) element. |
boolean | remove(Object o) |
SortedSet<E> | subSet(E fromElement,
E toElement) |
SortedSet<E> | tailSet(E fromElement) |
equals, hashCode, removeAlladdAll, containsAll, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitspliteratoraddAll, contains, containsAll, equals, hashCode, isEmpty, iterator, removeAll, retainAll, size, toArray, toArrayparallelStream, removeIf, streampublic UnmodifiableSortedSet(Collection<? extends E> c)
c - collection to copy and sortpublic UnmodifiableSortedSet(Collection<? extends E> c, Comparator<? super E> comparator)
c - collection to copy and sortcomparator - comparator for orderingpublic UnmodifiableSortedSet(Set<? extends E> c)
c - set to copy and sortpublic UnmodifiableSortedSet(Set<? extends E> c, Comparator<? super E> comparator)
c - set to copy and sortcomparator - comparator for orderingpublic UnmodifiableSortedSet(SortedSet<? extends E> c)
c - sorted set to copy, must already be sortedpublic UnmodifiableSortedSet(SortedSet<? extends E> c, Comparator<? super E> comparator)
c - sorted set to copy, must already be sortedcomparator - comparator for orderingpublic boolean add(E o)
ArraySetadd in interface Collection<E>add in interface Set<E>add in class ArraySet<E>o - the element to addUnsupportedOperationExceptionpublic void addUnique(E o)
ArraySetaddUnique in class ArraySet<E>o - non-null, NPE will not be thrownUnsupportedOperationExceptionpublic void clear()
clear in interface Collection<E>clear in interface Set<E>clear in class ArraySet<E>UnsupportedOperationExceptionpublic Comparator<? super E> comparator()
comparator in interface SortedSet<E>public SortedSet<E> headSet(E toElement)
headSet in interface SortedSet<E>UnsupportedOperationExceptionprotected int indexOf(Object o)
public boolean remove(Object o)
remove in interface Collection<E>remove in interface Set<E>remove in class ArraySet<E>UnsupportedOperationExceptionpublic SortedSet<E> subSet(E fromElement, E toElement)
subSet in interface SortedSet<E>UnsupportedOperationException