E - The type of the elements in the set.public final class SlimSet<E>
extends java.lang.Object
implements java.util.Set<E>, java.lang.Cloneable
Set implementation. While insert performance is mostly comparable to the default HashSet implementation, this set aims to
be much more memory efficient.
This class is not thread safe.
| Constructor and Description |
|---|
SlimSet()
Default constructor.
|
SlimSet(java.util.Collection<E> other)
Creates a set from the elements of another
Collection. |
SlimSet(E[] values)
Creates a set from the values in an array.
|
SlimSet(int size)
Constructor to create a set that can take at least the given number of elements before it needs to be rehashed.
|
SlimSet(int size,
float foadFactor)
Constructor to create a set that can take at least the given number of elements before it needs to be rehashed.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E object) |
boolean |
addAll(java.util.Collection<? extends E> c) |
void |
clear() |
protected SlimSet<E> |
clone() |
boolean |
contains(java.lang.Object object) |
boolean |
containsAll(java.util.Collection<?> c) |
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator() |
boolean |
remove(java.lang.Object object) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
public SlimSet()
public SlimSet(int size)
size - The number of elements that the set can hold before it needs to be resized and rehashed.public SlimSet(int size,
float foadFactor)
size - The number of elements that the set can hold before it needs to be resized and rehashed.foadFactor - The load factor if this set.public SlimSet(java.util.Collection<E> other)
Collection.other - The other collection that contains the initial values of this set.public SlimSet(E[] values)
values - An array holding the initial values of the set.public boolean contains(java.lang.Object object)
public boolean add(E object)
public boolean isEmpty()
public int size()
public boolean addAll(java.util.Collection<? extends E> c)
public void clear()
public boolean containsAll(java.util.Collection<?> c)
public java.util.Iterator<E> iterator()
public boolean remove(java.lang.Object object)
public boolean removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public int hashCode()