public class ZHash<KeyType,ValueType> extends Object implements ZIndexable<KeyType>
ZIndexable
. Provides fast element retrieval via hash key in addition to
mutable ordering (z indexing) of elements.Constructor and Description |
---|
ZHash() |
Modifier and Type | Method and Description |
---|---|
void |
addToBottom(KeyType key,
ValueType value)
If key already exists within the structure, it's value is replaced with the new value and
it's existing order is maintained.
|
void |
addToTop(KeyType key,
ValueType value)
If key already exists within the structure, it's value is replaced with the new value and
it's existing order is maintained.
|
List<KeyType> |
elements() |
ValueType |
get(KeyType key) |
List<KeyType> |
getKeysAsList() |
List<KeyType> |
keys() |
boolean |
moveAbove(KeyType objectToMove,
KeyType reference)
Move above the specified element
|
boolean |
moveBeneath(KeyType objectToMove,
KeyType reference)
Move beneath the specified element
|
boolean |
moveDown(KeyType key)
Move down by one element
|
boolean |
moveToBottom(KeyType key)
Move beneath all other elements
|
boolean |
moveToTop(KeyType element)
Move above all other elements
|
boolean |
moveUp(KeyType key)
Move up by one element
|
boolean |
remove(KeyType key) |
int |
size() |
public int size()
public void addToTop(KeyType key, ValueType value)
key
- value
- public void addToBottom(KeyType key, ValueType value)
key
- value
- public boolean moveToTop(KeyType element)
ZIndexable
moveToTop
in interface ZIndexable<KeyType>
public boolean moveAbove(KeyType objectToMove, KeyType reference)
ZIndexable
moveAbove
in interface ZIndexable<KeyType>
public boolean moveBeneath(KeyType objectToMove, KeyType reference)
ZIndexable
moveBeneath
in interface ZIndexable<KeyType>
public boolean moveToBottom(KeyType key)
ZIndexable
moveToBottom
in interface ZIndexable<KeyType>
public boolean moveUp(KeyType key)
ZIndexable
moveUp
in interface ZIndexable<KeyType>
public boolean moveDown(KeyType key)
ZIndexable
moveDown
in interface ZIndexable<KeyType>
public List<KeyType> elements()
elements
in interface ZIndexable<KeyType>
public boolean remove(KeyType key)