E - the element typepublic class OrderedSet<E> extends AbstractSet<E>
Set interface using an ordered list and binary search.| Modifier and Type | Class and Description |
|---|---|
class |
OrderedSet.Iter |
| Constructor and Description |
|---|
OrderedSet(Comparator<E> comparator)
Construct an
OrderedSet. |
OrderedSet(Comparator<E> comparator,
Collection<? extends E> c)
Construct an
OrderedSet, providing an initial collection. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e)
Add an element to the set.
|
void |
clear() |
boolean |
contains(Object o)
Test whether the set contains the specified object.
|
static <C extends Comparable<C>> |
create()
Create a new
OrderedSet of Comparable objects. |
Iterator<E> |
iterator()
Returns an
Iterator over the elements contained in this set. |
boolean |
remove(Object o)
Remove the specified object from the set.
|
int |
size() |
equals, hashCode, removeAlladdAll, containsAll, isEmpty, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, containsAll, isEmpty, retainAll, spliterator, toArray, toArrayparallelStream, removeIf, streampublic OrderedSet(Comparator<E> comparator)
OrderedSet.comparator - the comparator that determines the order of the setpublic OrderedSet(Comparator<E> comparator, Collection<? extends E> c)
OrderedSet, providing an initial collection.comparator - the comparator that determines the order of the setc - the initial contentspublic boolean contains(Object o)
contains in interface Collection<E>contains in interface Set<E>contains in class AbstractCollection<E>o - the objecttrue if the object is contained in the setNullPointerException - if the object is nullClassCastException - if the object is not of the class of the setCollection.contains(Object)public boolean add(E e)
add in interface Collection<E>add in interface Set<E>add in class AbstractCollection<E>e - the new elementtrue if the set changed as a result of the operationNullPointerException - if the object is nullCollection.add(Object)public boolean remove(Object o)
remove in interface Collection<E>remove in interface Set<E>remove in class AbstractCollection<E>o - the object to be removedNullPointerException - if the object is nullClassCastException - if the object is not of the class of the setCollection.remove(Object)public void clear()
clear in interface Collection<E>clear in interface Set<E>clear in class AbstractCollection<E>Collection.clear()public Iterator<E> iterator()
Iterator over the elements contained in this set. The elements are
returned in the order determined by the Comparator associated with the set.iterator in interface Iterable<E>iterator in interface Collection<E>iterator in interface Set<E>iterator in class AbstractCollection<E>IteratorCollection.iterator()public int size()
size in interface Collection<E>size in interface Set<E>size in class AbstractCollection<E>Collection.size()public static <C extends Comparable<C>> OrderedSet<C> create()
OrderedSet of Comparable objects.C - the class of the elementsCopyright © 2020. All rights reserved.