public final class ApproxRandSet<T> extends java.lang.Object implements java.util.Set<T>, IRandomAccessible<T>, java.io.Serializable
Constructor and Description |
---|
ApproxRandSet(java.util.Collection<T> c) |
ApproxRandSet(int initialCapacity)
Constructs a new, empty map with the specified initial capacity and
default load factor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T key)
Puts a key-value mapping into this map.
|
boolean |
addAll(java.util.Collection<? extends T> c)
Puts all the values from the specified map into this map.
|
void |
clear()
Clears the map, resetting the size to zero and nullifying references
to avoid garbage collection issues.
|
boolean |
contains(java.lang.Object key)
Checks whether the map contains the specified key.
|
boolean |
containsAll(java.util.Collection<?> c) |
T |
getRandom(java.util.Random r) |
boolean |
isEmpty()
Checks whether the map is currently empty.
|
java.util.Iterator<T> |
iterator() |
static void |
main(java.lang.String[] args) |
boolean |
remove(java.lang.Object key)
Removes the specified mapping from this map.
|
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size()
Gets the size of the map.
|
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
public ApproxRandSet(int initialCapacity)
initialCapacity
- the initial capacityjava.lang.IllegalArgumentException
- if the initial capacity is less than onepublic ApproxRandSet(java.util.Collection<T> c)
public int size()
public boolean isEmpty()
public boolean contains(java.lang.Object key)
public boolean add(T key)
public boolean addAll(java.util.Collection<? extends T> c)
#put(Object, Object)
.public boolean remove(java.lang.Object key)
public void clear()
public T getRandom(java.util.Random r)
getRandom
in interface IRandomAccessible<T>
public java.util.Iterator<T> iterator()
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean containsAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
public boolean removeAll(java.util.Collection<?> c)
public static void main(java.lang.String[] args)