Package nom.tam.util
Class HashedList<VALUE extends CursorValue<java.lang.String>>
- java.lang.Object
-
- nom.tam.util.HashedList<VALUE>
-
- Type Parameters:
VALUE- value of the map
- All Implemented Interfaces:
java.lang.Iterable<VALUE>,java.util.Collection<VALUE>
public class HashedList<VALUE extends CursorValue<java.lang.String>> extends java.lang.Object implements java.util.Collection<VALUE>a ordered hash map implementation.
-
-
Constructor Summary
Constructors Constructor Description HashedList()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(VALUE e)booleanaddAll(java.util.Collection<? extends VALUE> c)voidclear()booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection<?> c)booleancontainsKey(java.lang.Object key)VALUEget(int n)VALUEget(java.lang.Object key)booleanisEmpty()nom.tam.util.HashedList.HashedListIteratoriterator()Cursor<java.lang.String,VALUE>iterator(int n)nom.tam.util.HashedList.HashedListIteratoriterator(java.lang.String key)booleanremove(int index)Remove an object from the list giving the object index..booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanremoveKey(java.lang.Object key)Remove a keyed object from the list.booleanreplaceKey(java.lang.String oldKey, java.lang.String newKey)Replace the key of a given element.booleanretainAll(java.util.Collection<?> c)intsize()voidsort(java.util.Comparator<java.lang.String> comp)Sort the keys into some desired order.java.lang.Object[]toArray()<T> T[]toArray(T[] o)java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
add
public boolean add(VALUE e)
- Specified by:
addin interfacejava.util.Collection<VALUE extends CursorValue<java.lang.String>>
-
addAll
public boolean addAll(java.util.Collection<? extends VALUE> c)
- Specified by:
addAllin interfacejava.util.Collection<VALUE extends CursorValue<java.lang.String>>
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Collection<VALUE extends CursorValue<java.lang.String>>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
containsin interfacejava.util.Collection<VALUE extends CursorValue<java.lang.String>>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAllin interfacejava.util.Collection<VALUE extends CursorValue<java.lang.String>>
-
containsKey
public boolean containsKey(java.lang.Object key)
- Parameters:
key- the key to search- Returns:
trueif the key is included in the list.
-
get
public VALUE get(int n)
- Parameters:
n- the index to get- Returns:
- the n'th entry from the beginning.
-
get
public VALUE get(java.lang.Object key)
- Parameters:
key- the key to search for- Returns:
- the value of a keyed entry. Non-keyed entries may be returned by requesting an iterator.
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Collection<VALUE extends CursorValue<java.lang.String>>
-
iterator
public nom.tam.util.HashedList.HashedListIterator iterator()
- Specified by:
iteratorin interfacejava.util.Collection<VALUE extends CursorValue<java.lang.String>>- Specified by:
iteratorin interfacejava.lang.Iterable<VALUE extends CursorValue<java.lang.String>>- Returns:
- a HashedListIterator over the entire list.
-
iterator
public Cursor<java.lang.String,VALUE> iterator(int n)
- Parameters:
n- the index to start the iterator- Returns:
- an iterator starting with the n'th entry.
-
iterator
public nom.tam.util.HashedList.HashedListIterator iterator(java.lang.String key)
- Parameters:
key- the key to use as a start point- Returns:
- an iterator over the list starting with the entry with a given key.
-
remove
public boolean remove(int index)
Remove an object from the list giving the object index..- Parameters:
index- the index to remove- Returns:
- true if the index was in range
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
removein interfacejava.util.Collection<VALUE extends CursorValue<java.lang.String>>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAllin interfacejava.util.Collection<VALUE extends CursorValue<java.lang.String>>
-
removeKey
public boolean removeKey(java.lang.Object key)
Remove a keyed object from the list. Unkeyed objects can be removed from the list using a HashedListIterator or using the remove(Object) method.- Parameters:
key- the key to remove- Returns:
trueif the key was removed
-
replaceKey
public boolean replaceKey(java.lang.String oldKey, java.lang.String newKey)Replace the key of a given element.- Parameters:
oldKey- The previous key. This key must be present in the hash.newKey- The new key. This key must not be present in the hash.- Returns:
- if the replacement was successful.
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAllin interfacejava.util.Collection<VALUE extends CursorValue<java.lang.String>>
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection<VALUE extends CursorValue<java.lang.String>>
-
sort
public void sort(java.util.Comparator<java.lang.String> comp)
Sort the keys into some desired order.- Parameters:
comp- the comparator to use for the sorting
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArrayin interfacejava.util.Collection<VALUE extends CursorValue<java.lang.String>>
-
toArray
public <T> T[] toArray(T[] o)
- Specified by:
toArrayin interfacejava.util.Collection<VALUE extends CursorValue<java.lang.String>>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-