public final class HashedSet<E> extends Object implements Set<E>
Set
interface, and serves as a zero-garbage memory-efficient replacement
for the JRE's HashSet
class.
HashedMapIntValue
class with all the advantages that advertises in terms of reduced memory churn
and garbage generation.
Like the JRE's HashSet
, this class implements all optional Set
operations.
Beware that this class is single-threaded and non-reentrant.
Constructor and Description |
---|
HashedSet() |
HashedSet(int initcap) |
HashedSet(int initcap,
float factor) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E obj) |
boolean |
addAll(Collection<? extends E> coll) |
void |
clear() |
boolean |
contains(Object obj) |
boolean |
containsAll(Collection<?> coll) |
E |
get(E obj) |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
Iterator<E> |
recycledIterator() |
boolean |
remove(Object obj) |
boolean |
removeAll(Collection<?> coll) |
boolean |
retainAll(Collection<?> coll) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] arr) |
String |
toString() |
int |
trimToSize() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode, spliterator
parallelStream, removeIf, stream
public HashedSet()
public HashedSet(int initcap)
public HashedSet(int initcap, float factor)
public int size()
public boolean isEmpty()
public boolean contains(Object obj)
public boolean add(E obj)
public boolean remove(Object obj)
public void clear()
public boolean containsAll(Collection<?> coll)
containsAll
in interface Collection<E>
containsAll
in interface Set<E>
public boolean addAll(Collection<? extends E> coll)
public boolean retainAll(Collection<?> coll)
public boolean removeAll(Collection<?> coll)
public Object[] toArray()
public <T> T[] toArray(T[] arr)
public int trimToSize()
Copyright 2010-2018 Grey Software (Yusef Badri). All Rights Reserved.