Package dev.nm.misc.datastructure
Class IdentityHashSet<T>
java.lang.Object
dev.nm.misc.datastructure.IdentityHashSet<T>
- Type Parameters:
T
- a type
- All Implemented Interfaces:
Iterable<T>
,Collection<T>
,Set<T>
This class implements the Set interface with a hash table, using reference-equality in place of
object-equality when comparing keys and values.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct an emptyIdentityHashSet
.IdentityHashSet
(Collection<T> col) Construct anIdentityHashSet
with a collection of items. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll
(Collection<? extends T> c) void
clear()
boolean
boolean
containsAll
(Collection<?> c) boolean
int
hashCode()
boolean
isEmpty()
iterator()
boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) int
size()
Object[]
toArray()
<T> T[]
toArray
(T[] a) toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
spliterator
-
Constructor Details
-
IdentityHashSet
public IdentityHashSet()Construct an emptyIdentityHashSet
. -
IdentityHashSet
Construct anIdentityHashSet
with a collection of items.- Parameters:
col
- a collection of items
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
public <T> T[] toArray(T[] a) -
add
-
remove
-
containsAll
- Specified by:
containsAll
in interfaceCollection<T>
- Specified by:
containsAll
in interfaceSet<T>
-
addAll
-
retainAll
-
removeAll
-
clear
public void clear() -
hashCode
public int hashCode() -
equals
-
toString
-