Class OrderedHashSet<T>
java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractSet<T>
java.util.HashSet<T>
java.util.LinkedHashSet<T>
org.graalvm.shadowed.org.antlr.v4.runtime.misc.OrderedHashSet<T>
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<T>,Collection<T>,SequencedCollection<T>,SequencedSet<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
LinkedHashSet.
- 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()clone()elements()Return the List holding list of table elements.booleanget(int i) inthashCode()iterator()booleanremove(int i) 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.Object[]toArray()toString()Methods inherited from class java.util.LinkedHashSet
addFirst, addLast, getFirst, getLast, newLinkedHashSet, removeFirst, removeLast, reversed, spliteratorMethods inherited from class java.util.AbstractSet
removeAllMethods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAllMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Field Details
-
elements
-
-
Constructor Details
-
OrderedHashSet
public OrderedHashSet()
-
-
Method Details
-
get
-
set
-
remove
public boolean remove(int i) -
add
-
remove
-
clear
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<T>- Specified by:
hashCodein interfaceSet<T>- Overrides:
hashCodein classAbstractSet<T>
-
equals
- Specified by:
equalsin interfaceCollection<T>- Specified by:
equalsin interfaceSet<T>- Overrides:
equalsin classAbstractSet<T>
-
iterator
-
elements
-
clone
-
toArray
-
toString
- Overrides:
toStringin classAbstractCollection<T>
-