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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classHashedList.EntryComparator<VALUE extends CursorValue<String>>private class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidAdd an element to the list at a specified position.booleanbooleanaddAll(Collection<? extends VALUE> c) voidclear()booleanbooleancontainsAll(Collection<?> c) booleancontainsKey(Object key) get(int n) (package private) intprivate booleaninternalRemove(int index, VALUE entry) booleanisEmpty()iterator()iterator(int n) booleanremove(int index) Remove an object from the list giving the object index..booleanbooleanremoveAll(Collection<?> c) booleanRemove a keyed object from the list.booleanreplaceKey(String oldKey, String newKey) Replace the key of a given element.booleanretainAll(Collection<?> c) intsize()voidsort(Comparator<String> comp) Sort the keys into some desired order.Object[]toArray()<T> T[]toArray(T[] o) toString()private static booleanunkeyedKey(String key) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
ordered
An ordered list of the keys -
keyed
The key value pairs
-
-
Constructor Details
-
HashedList
public HashedList()
-
-
Method Details
-
add
Add an element to the list at a specified position. If that element was already in the list, it is first removed from the list then added again - if it was removed from a position before the position where it was to be added, that position is decremented by one.- Parameters:
pos- The position at which the specified element is to be added. If pos is bigger than the size of the list the element is put at the end of the list.reference- The element to add to the list.
-
unkeyedKey
-
add
- Specified by:
addin interfaceCollection<VALUE extends CursorValue<String>>
-
addAll
- Specified by:
addAllin interfaceCollection<VALUE extends CursorValue<String>>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<VALUE extends CursorValue<String>>
-
contains
- Specified by:
containsin interfaceCollection<VALUE extends CursorValue<String>>
-
containsAll
- Specified by:
containsAllin interfaceCollection<VALUE extends CursorValue<String>>
-
containsKey
- Parameters:
key- the key to search- Returns:
trueif the key is included in the list.
-
get
- Parameters:
n- the index to get- Returns:
- the n'th entry from the beginning.
-
get
-
indexOf
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<VALUE extends CursorValue<String>>
-
iterator
- Specified by:
iteratorin interfaceCollection<VALUE extends CursorValue<String>>- Specified by:
iteratorin interfaceIterable<VALUE extends CursorValue<String>>- Returns:
- a HashedListIterator over the entire list.
-
iterator
-
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
-
internalRemove
-
remove
- Specified by:
removein interfaceCollection<VALUE extends CursorValue<String>>
-
removeAll
- Specified by:
removeAllin 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:
trueif the key was removed
-
replaceKey
-
retainAll
- Specified by:
retainAllin interfaceCollection<VALUE extends CursorValue<String>>
-
size
public int size()- Specified by:
sizein 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:
toArrayin interfaceCollection<VALUE extends CursorValue<String>>
-
toArray
public <T> T[] toArray(T[] o) - Specified by:
toArrayin interfaceCollection<VALUE extends CursorValue<String>>
-
toString
-