Package nom.tam.util
Class HashedList<VALUE extends CursorValue<String>>
java.lang.Object
nom.tam.util.HashedList<VALUE>
- Type Parameters:
VALUE
- value of the map
- All Implemented Interfaces:
Iterable<VALUE>
,Collection<VALUE>
public class HashedList<VALUE extends CursorValue<String>>
extends Object
implements Collection<VALUE>
a ordered hash map implementation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll
(Collection<? extends VALUE> c) void
clear()
boolean
boolean
containsAll
(Collection<?> c) boolean
containsKey
(Object key) get
(int n) boolean
isEmpty()
HashedList<VALUE>.nom.tam.util.HashedList.HashedListIterator
iterator()
iterator
(int n) HashedList<VALUE>.nom.tam.util.HashedList.HashedListIterator
boolean
remove
(int index) Remove an object from the list giving the object index..boolean
boolean
removeAll
(Collection<?> c) boolean
Remove a keyed object from the list.boolean
replaceKey
(String oldKey, String newKey) Replace the key of a given element.boolean
retainAll
(Collection<?> c) int
size()
void
sort
(Comparator<String> comp) Sort the keys into some desired order.Object[]
toArray()
<T> T[]
toArray
(T[] o) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
HashedList
public HashedList()
-
-
Method Details
-
add
- Specified by:
add
in interfaceCollection<VALUE extends CursorValue<String>>
-
addAll
- Specified by:
addAll
in interfaceCollection<VALUE extends CursorValue<String>>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<VALUE extends CursorValue<String>>
-
contains
- Specified by:
contains
in interfaceCollection<VALUE extends CursorValue<String>>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<VALUE extends CursorValue<String>>
-
containsKey
- Parameters:
key
- the key to search- Returns:
true
if the key is included in the list.
-
get
- Parameters:
n
- the index to get- Returns:
- the n'th entry from the beginning.
-
get
- 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:
isEmpty
in interfaceCollection<VALUE extends CursorValue<String>>
-
iterator
- Specified by:
iterator
in interfaceCollection<VALUE extends CursorValue<String>>
- Specified by:
iterator
in interfaceIterable<VALUE extends CursorValue<String>>
- Returns:
- a HashedListIterator over the entire list.
-
iterator
- Parameters:
n
- the index to start the iterator- Returns:
- an iterator starting with the n'th entry.
-
iterator
- 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
- Specified by:
remove
in interfaceCollection<VALUE extends CursorValue<String>>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<VALUE extends CursorValue<String>>
-
removeKey
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:
true
if the key was removed
-
replaceKey
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
- Specified by:
retainAll
in interfaceCollection<VALUE extends CursorValue<String>>
-
size
public int size()- Specified by:
size
in interfaceCollection<VALUE extends CursorValue<String>>
-
sort
Sort the keys into some desired order.- Parameters:
comp
- the comparator to use for the sorting
-
toArray
- Specified by:
toArray
in interfaceCollection<VALUE extends CursorValue<String>>
-
toArray
public <T> T[] toArray(T[] o) - Specified by:
toArray
in interfaceCollection<VALUE extends CursorValue<String>>
-
toString
-