java.lang.Object | |
↳ | com.microstrategy.utils.HashList<K, V> |
The HashList class allows the user to add, remove and examine the s in a given collection. The s can be access either by the index or by the key in the collection. This collection can also be used as read only.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
HashList()
Constructs a new, empty Collection with a default read-only value of false.
| |||||||||||
HashList(int initialCapacity) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
add(K key, V newItem)
Adds the , with the specified key, into the collection.
| ||||||||||
void |
clear()
Clears all items from the collection.
| ||||||||||
Object | clone() | ||||||||||
boolean |
containsKey(K key)
Returns true if the key is already in the collection, false otherwise.
| ||||||||||
boolean |
containsValue(V value)
Returns true if this collection maps one or more keys to the specified value.
| ||||||||||
Enumeration<V> |
elements()
Return the enumeration of the items inside this list.
| ||||||||||
V |
get(int index)
Gets the contained in the specified index of the collection.
| ||||||||||
V |
get(K key)
Returns the contained with the specified key in the collection.
| ||||||||||
HashMap<K, V> |
getItemSet()
This method is deprecated.
replaced by
items()
| ||||||||||
K |
getKey(int index)
Gets the key of the item contained in the specified index of the collection.
| ||||||||||
ArrayList<K> |
getKeyList()
This method is deprecated.
replaced by
keys()
| ||||||||||
int |
indexOf(K key)
Returns the index of the given key.
| ||||||||||
boolean |
isEmpty()
Returns true if the collection is empyt, false otherwise.
| ||||||||||
Map<K, V> |
items()
Returns an unmodifiable
Map of the items. | ||||||||||
List<K> |
keys()
Returns an unmodifiable
List of the keys. | ||||||||||
void |
put(K key, V newItem)
Adds or replaces the , with the specified key, into the collection.
| ||||||||||
void |
putAll(Map<K, V> m)
Adds all the s in the map to the collection
| ||||||||||
void |
putAll(HashList<K, V> list)
Adds all the s in the HashList in the same order defined in it.
| ||||||||||
V |
remove(int index)
Removes the contained in the specified index of the collection.
| ||||||||||
V |
remove(K key)
Removes the contained with the specified key in the collection.
| ||||||||||
V |
replace(K key, V newItem)
Replace the current item associated with the given key.
| ||||||||||
void |
setItemSet(HashMap<K, V> newValue)
This method is deprecated.
dangerous method pending removal
| ||||||||||
void |
setKeyList(ArrayList<K> newValue)
This method is deprecated.
dangerous method pending removal
| ||||||||||
int |
size()
Returns the current size of the collection.
| ||||||||||
void |
sort(Comparator<K> comp)
Sorts the existing list according to the order induced by the
specified comparator.
| ||||||||||
String |
toString()
Returns a string representation of the .
| ||||||||||
Collection<V> | values() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Constructs a new, empty Collection with a default read-only value of false.
Adds the , with the specified key, into the collection. Throws UnsupportedOperationException in case the collection is a read-only ; and IllegalArgumentException in case the key is null, or it already exists in the collection.
key | The key used to identify the in the collection. |
---|---|
newItem | The to add to the collection. |
IllegalArgumentException | Thrown if the given key is already contained in the collection. |
---|
Clears all items from the collection.
CloneNotSupportedException |
---|
Returns true if the key is already in the collection, false otherwise.
key | The key that we want to look for in the collection. |
---|
Returns true if this collection maps one or more keys to the specified value.
value | value whose presence in this collection is to be tested. |
---|
Return the enumeration of the items inside this list.
Gets the contained in the specified index of the collection. Throws IndexOutOfBoundsException in case the index is greater than the collection size or < 0.
index | The index of the item in the collection to get. |
---|
IndexOutOfBoundsException | Thrown if no item in the collection has the given index. |
---|
Returns the contained with the specified key in the collection. Throws IllegalArgumentException in case the key does not exist in the collection.
key | The key of the item in the collection to get. |
---|
IllegalArgumentException | Thrown if no item in the collection has the given key. |
---|
This method is deprecated.
replaced by items()
Do NOT use! Altering the contents of the Map
can corrupt the underlying HashList
.
Gets the key of the item contained in the specified index of the collection. Throws IndexOutOfBoundsException in case the index is greater than the collection size or < 0.
index | The index of the item in the collection. |
---|
IndexOutOfBoundsException | thrown if no item in the collection has the given index. |
---|
This method is deprecated.
replaced by keys()
Do NOT use! Altering the contents of the Map
can corrupt the underlying HashList
.
Returns the index of the given key.
key | that represents the key. |
---|
Returns true if the collection is empyt, false otherwise.
Returns an unmodifiable Map
of the items.
Returns an unmodifiable List
of the keys.
Adds or replaces the , with the specified key, into the collection. Throws UnsupportedOperationException in case the collection is a read-only
key | The key used to identify the in the collection. |
---|---|
newItem | The to add to the collection. |
IllegalArgumentException | Thrown if the given key is already contained in the collection. |
---|
Adds all the s in the map to the collection
m | A Map with a list of key/value entries. |
---|
IllegalArgumentException | Thrown if any of the given keys is already contained in the collection. |
---|
Adds all the s in the HashList in the same order defined in it.
list | A HashList with a list of key/value entries. |
---|
IllegalArgumentException | Thrown if any of the given keys is already contained in the collection. |
---|
Removes the contained in the specified index of the collection. Throws IndexOutOfBoundsException in case the index is greater than the collection size or < 0; and UnsupportedOperationException in case the collection is a read-only .
index | The index of the item in the collection to remove. |
---|
IndexOutOfBoundsException | Thrown if no item in the collection has the given index. |
---|
Removes the contained with the specified key in the collection. Throws IllegalArgumentException if the key is not contained in the collection; and UnsupportedOperationException in case the collection is a read-only .
key | The key of the item in the collection to remove. |
---|
IllegalArgumentException | Thrown if no item in the collection has the given key. |
---|
Replace the current item associated with the given key. Returns the item that was previously associated. Throws an exception If there is no element with the given value or with a null key.
key | the key of the element to replace |
---|---|
newItem | the new item to be inserted. |
This method is deprecated.
dangerous method pending removal
Do NOT use! Altering the contents of the Map
can corrupt the underlying HashList
.
This method is deprecated.
dangerous method pending removal
Do NOT use! Altering the contents of the Map
can corrupt the underlying HashList
.
Returns the current size of the collection.
Sorts the existing list according to the order induced by the specified comparator.
Returns a string representation of the .