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>
public class IdentityHashSet<T> extends Object implements 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:
- Bug issue #4479578
-
-
Constructor Summary
Constructors Constructor Description IdentityHashSet()Construct an emptyIdentityHashSet.IdentityHashSet(Collection<T> col)Construct anIdentityHashSetwith a collection of items.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(T e)booleanaddAll(Collection<? extends T> c)voidclear()booleancontains(Object o)booleancontainsAll(Collection<?> c)booleanequals(Object obj)inthashCode()booleanisEmpty()Iterator<T>iterator()booleanremove(Object o)booleanremoveAll(Collection<?> c)booleanretainAll(Collection<?> c)intsize()Object[]toArray()<T> T[]toArray(T[] a)StringtoString()-
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 Detail
-
IdentityHashSet
public IdentityHashSet()
Construct an emptyIdentityHashSet.
-
IdentityHashSet
public IdentityHashSet(Collection<T> col)
Construct anIdentityHashSetwith a collection of items.- Parameters:
col- a collection of items
-
-
Method Detail
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
contains
public boolean contains(Object o)
-
toArray
public Object[] toArray()
-
toArray
public <T> T[] toArray(T[] a)
-
add
public boolean add(T e)
-
remove
public boolean remove(Object o)
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<T>- Specified by:
containsAllin interfaceSet<T>
-
addAll
public boolean addAll(Collection<? extends T> c)
-
retainAll
public boolean retainAll(Collection<?> c)
-
removeAll
public boolean removeAll(Collection<?> c)
-
clear
public void clear()
-
hashCode
public int hashCode()
-
equals
public boolean equals(Object obj)
-
-