TKey
- The key typeTValue
- The value typepublic interface IHashtable<TKey extends java.lang.Comparable<TKey>,TValue> extends ReifiedMap<TKey,TValue>
Modifier and Type | Method and Description |
---|---|
void |
add(KeyValuePair<? extends TKey,? extends TValue> kvp)
Adds an element represented by the provided key/value pair if the key is not already present.
|
boolean |
add(TKey key,
TValue value)
Adds the provided key/value pair if the key is not already present.
|
void |
clear()
Removes all elements from this hash table.
|
boolean |
contains(KeyValuePair<? extends TKey,? extends TValue> kvp)
Returns true if the key of the key/value pair exists in the key collection
|
boolean |
containsKey(TKey key)
Returns true if the key of the key/value pair exists in the key collection
|
TValue |
get(TKey key)
Gets the value associated with the specified key.
|
KeyCollection<TKey,TValue> |
getKeys()
Gets a collection containing all the keys.
|
ValueCollection<TKey,TValue> |
getValues()
Gets a collection containing all the values.
|
boolean |
remove(KeyValuePair<? extends TKey,? extends TValue> kvp)
Removes a key/value pair based on its key.
|
boolean |
remove(TKey key)
Removes the value associated with the specified key.
|
boolean |
replace(TKey key,
TValue value)
Replaces a key's value with the specified value.
|
int |
size()
Gets the number of key/value pairs contained.
|
TryResult<TValue> |
tryGetValue(TKey key)
Attempts to get a value by a given key.
|
getGenericTypeParameterKey, getGenericTypeParameterValue
void add(KeyValuePair<? extends TKey,? extends TValue> kvp)
kvp
- The key/value pair to add.java.lang.NullPointerException
- If the key value pair or the key is null.boolean add(TKey key, TValue value)
key
- The key to add.value
- The value to add.java.lang.NullPointerException
- If the key is null.void clear()
boolean contains(KeyValuePair<? extends TKey,? extends TValue> kvp)
kvp
- A key value pair (only the key is used).java.lang.NullPointerException
- If the key is null.boolean containsKey(TKey key)
key
- The key to find.java.lang.NullPointerException
- If the key is null.TValue get(TKey key)
key
- The key to find.java.lang.NullPointerException
- If the key is null.KeyNotFoundException
- If the key is not found.KeyCollection<TKey,TValue> getKeys()
ValueCollection<TKey,TValue> getValues()
boolean remove(KeyValuePair<? extends TKey,? extends TValue> kvp)
kvp
- The key/value pair (only the key is used).java.lang.NullPointerException
- If the key/value pair or the key is null.boolean remove(TKey key)
key
- The key to find.java.lang.NullPointerException
- If the key is null.boolean replace(TKey key, TValue value)
key
- The key to find.value
- The new value.java.lang.NullPointerException
- When the key is null.int size()
size
in interface ReifiedMap<TKey extends java.lang.Comparable<TKey>,TValue>