Class OrderedHashSet<T>
java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractSet<T>
java.util.HashSet<T>
java.util.LinkedHashSet<T>
org.antlr.misc.OrderedHashSet<T>
- All Implemented Interfaces:
Serializable, Cloneable, Iterable<T>, Collection<T>, Set<T>
A HashMap that remembers the order that the elements were added.
You can alter the ith element with set(i,value) too :) Unique list.
I need the replace/set-element-i functionality so I'm subclassing
OrderedHashSet.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd a value to list; keep in hashtable for consistency also; Key is object itself.voidclear()elements()Return the List holding list of table elements.get(int i) iterator()booleanReplace an existing value with a new value; updates the element list and the hash table, but not the key as that has not changed.intsize()Object[]toArray()toString()Methods inherited from class LinkedHashSet
spliteratorMethods inherited from class AbstractSet
equals, hashCode, removeAllMethods inherited from class AbstractCollection
addAll, containsAll, retainAll, toArrayMethods inherited from interface Collection
parallelStream, removeIf, stream
-
Field Details
-
elements
-
-
Constructor Details
-
OrderedHashSet
public OrderedHashSet()
-
-
Method Details
-
get
-
set
-
add
-
remove
-
clear
-
elements
-
iterator
-
toArray
- Specified by:
toArrayin interfaceCollection<T>- Specified by:
toArrayin interfaceSet<T>- Overrides:
toArrayin classAbstractCollection<T>
-
size
-
toString
- Overrides:
toStringin classAbstractCollection<T>
-