public class KeyedHashSet
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
elementCount |
protected KeyedElement[] |
elements |
protected static int |
MINIMUM_SIZE |
protected boolean |
replace |
| Constructor and Description |
|---|
KeyedHashSet() |
KeyedHashSet(int capacity) |
KeyedHashSet(int capacity,
boolean replace) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(KeyedElement element)
Adds an element to this set.
|
void |
clear() |
KeyedElement[] |
elements() |
java.lang.Object[] |
elements(java.lang.Object[] result) |
protected void |
expand()
The array isn't large enough so double its size and rehash
all its current values.
|
KeyedElement |
get(KeyedElement key)
Returns the set element with the given id, or null
if not found.
|
KeyedElement |
getByKey(java.lang.Object key)
Returns the set element with the given id, or null
if not found.
|
boolean |
isEmpty() |
protected void |
rehashTo(int anIndex)
The element at the given index has been removed so move
elements to keep the set properly hashed.
|
boolean |
remove(KeyedElement toRemove) |
boolean |
removeByKey(java.lang.Object key) |
int |
size() |
java.lang.String |
toString() |
protected static final int MINIMUM_SIZE
protected int elementCount
protected KeyedElement[] elements
protected boolean replace
public KeyedHashSet()
public KeyedHashSet(int capacity)
public KeyedHashSet(int capacity,
boolean replace)
public boolean add(KeyedElement element)
public void clear()
public KeyedElement[] elements()
public java.lang.Object[] elements(java.lang.Object[] result)
protected void expand()
public KeyedElement get(KeyedElement key)
public KeyedElement getByKey(java.lang.Object key)
public boolean isEmpty()
protected void rehashTo(int anIndex)
public boolean remove(KeyedElement toRemove)
public boolean removeByKey(java.lang.Object key)
public int size()
public java.lang.String toString()
toString in class java.lang.Object