E - the generic type of elements maintained by this setpublic class InsertionOrderSet<E> extends LinkedHashSet<E>
InsertionOrderSet overwrites the add-method from the LinkedHashSet.
That inserts the value to the right order it was inserted in the Map. Note that the difference in
the LinkedHashMap is the order does not change if we put the same key with a new value. In this
class the order changes when we put a new value with the same key.LinkedHashSet,
Serialized Form| Constructor and Description |
|---|
InsertionOrderSet()
Constructs an empty insertion-ordered InsertionOrderSet instance with a default
capacity (16) and load factor (0.75).
|
InsertionOrderSet(Collection<? extends E> c)
Constructs a new insertion order hash set with the same elements as the specified collection.
|
InsertionOrderSet(int initialCapacity)
Constructs an empty insertion-ordered InsertionOrderSet instance with the specified
initial capacity and a default load factor (0.75).
|
InsertionOrderSet(int initialCapacity,
float loadFactor)
Constructs an empty insertion-ordered InsertionOrderMap instance with the specified
initial capacity and load factor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E o)
Adds the specified object to this set.
|
static <E> Set<E> |
setOf(E... elements)
Factory method for create an
InsertionOrderSet with the given elements. |
spliteratorclear, clone, contains, isEmpty, iterator, remove, sizeequals, hashCode, removeAlladdAll, containsAll, retainAll, toArray, toArray, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitaddAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArrayparallelStream, removeIf, streampublic InsertionOrderSet()
public InsertionOrderSet(Collection<? extends E> c)
c - the collection whose elements are to be placed into this set.NullPointerException - if the specified collection is null.public InsertionOrderSet(int initialCapacity)
initialCapacity - the initial capacity.IllegalArgumentException - if the initial capacity is negative.public InsertionOrderSet(int initialCapacity,
float loadFactor)
initialCapacity - the initial capacity.loadFactor - the load factor.IllegalArgumentException - if the initial capacity is negative or the load factor is nonpositive.public static <E> Set<E> setOf(E... elements)
InsertionOrderSet with the given elements.E - the generic type of the elementselements - The given elements.InsertionOrderSet that contains the given elements.public boolean add(E o)
Copyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.