public class AvlTreeList<TKey extends java.lang.Comparable<TKey>,TValue> extends java.lang.Object implements IListMap<TKey,TValue>
Constructor and Description |
---|
AvlTreeList()
Default constructor
|
AvlTreeList(java.lang.Class<?> genericTypeParameterKey,
java.lang.Class<?> genericTypeParameterValue)
Constructor for initializing with the key/value generic type parameters
|
AvlTreeList(java.util.Map<? extends TKey,? extends TValue> map)
Constructor initializes from another map
|
AvlTreeList(java.util.Map<? extends TKey,? extends TValue> map,
java.lang.Class<?> genericTypeParameterKey,
java.lang.Class<?> genericTypeParameterValue)
Constructor initializes from another map and the list-map's key/value generic type parameters
|
AvlTreeList(ReifiedMap<TKey,TValue> map)
Constructor initializes with another reified map
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(KeyValuePair<? extends TKey,? extends TValue> kvp)
Adds a new key/value pair.
|
boolean |
add(TKey key,
TValue value)
Adds a new key/value pair.
|
void |
clear()
Removes all keys and values.
|
boolean |
contains(TKey key)
Returns true if a key is found.
|
TValue |
get(TKey key)
Returns the key's value if it exists, otherwise throws KeyNotFoundException.
|
TValue |
getAt(int index)
Returns the key's value if the position exists.
|
java.lang.Class<?> |
getGenericTypeParameterKey()
Returns the TKey generic type parameter's class.
|
java.lang.Class<?> |
getGenericTypeParameterValue()
Returns the TValue generic type parameter's class.
|
java.lang.Iterable<TKey> |
getKeys()
Returns all keys in ascending key order.
|
java.lang.Iterable<TValue> |
getValues()
Returns all values in the order they were input.
|
int |
indexOf(TKey key)
Returns the index of the given key, if it is contained in the collection.
|
java.util.Iterator<KeyValuePair<TKey,TValue>> |
iterator()
Returns an ascending key order iterator.
|
boolean |
remove(TKey key)
Removes an item from the collection.
|
void |
removeAt(int index)
Removes an item from the collection.
|
boolean |
replace(TKey key,
TValue newValue)
Replaces a key's value with the specified new value.
|
void |
replaceAt(int index,
TValue newValue)
Sets a value at the specified index.
|
int |
size()
Returns the number of elements in the collection.
|
public AvlTreeList()
SuperTypeTokenException
- When called without using anonymous class semantics.public AvlTreeList(java.lang.Class<?> genericTypeParameterKey, java.lang.Class<?> genericTypeParameterValue)
java.lang.NullPointerException
- When a generic type parameter is null.public AvlTreeList(ReifiedMap<TKey,TValue> map)
java.lang.NullPointerException
- When the argument is null.public AvlTreeList(java.util.Map<? extends TKey,? extends TValue> map)
SuperTypeTokenException
- When called without using anonymous class semantics.java.lang.NullPointerException
- When the argument is null.public AvlTreeList(java.util.Map<? extends TKey,? extends TValue> map, java.lang.Class<?> genericTypeParameterKey, java.lang.Class<?> genericTypeParameterValue)
java.lang.NullPointerException
- When an argument is null.public boolean add(TKey key, TValue value)
public boolean add(KeyValuePair<? extends TKey,? extends TValue> kvp)
public void clear()
public boolean contains(TKey key)
public TValue get(TKey key)
public TValue getAt(int index)
public java.lang.Class<?> getGenericTypeParameterKey()
getGenericTypeParameterKey
in interface ReifiedMap<TKey extends java.lang.Comparable<TKey>,TValue>
public java.lang.Class<?> getGenericTypeParameterValue()
getGenericTypeParameterValue
in interface ReifiedMap<TKey extends java.lang.Comparable<TKey>,TValue>
public java.lang.Iterable<TKey> getKeys()
public java.lang.Iterable<TValue> getValues()
public int indexOf(TKey key)
public java.util.Iterator<KeyValuePair<TKey,TValue>> iterator()
iterator
in interface java.lang.Iterable<KeyValuePair<TKey extends java.lang.Comparable<TKey>,TValue>>
public boolean remove(TKey key)
public void removeAt(int index)
public boolean replace(TKey key, TValue newValue)
public void replaceAt(int index, TValue newValue)