public class UnmodifiableTrie<K,V> extends Objectimplements Trie <K ,V>, Serializable , Unmodifiable
Trie.
| Constructor and Description |
|---|
UnmodifiableTrie(Trie
Constructor that wraps (not copies).
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
|
Comparator |
comparator()
|
boolean |
containsKey(Object
|
boolean |
containsValue(Object
|
Set |
entrySet()
|
boolean |
equals(Object
|
K |
firstKey()
Gets the first key currently in this map.
|
V |
get(Object
|
int |
hashCode()
|
SortedMap |
headMap(K toKey)
|
boolean |
isEmpty()
|
Set |
keySet()
|
K |
lastKey()
Gets the last key currently in this map.
|
OrderedMapIterator |
mapIterator()
Obtains an
OrderedMapIterator over the map.
|
K |
nextKey(K key)
Gets the next key after the one specified.
|
SortedMap |
prefixMap(K key)
Returns a view of this
Trie of all elements that are prefixed by the given key.
|
K |
previousKey(K key)
Gets the previous key before the one specified.
|
V |
put(K key, V value)
Note that the return type is Object, rather than V as in the Map interface.
|
void |
putAll(Map
|
V |
remove(Object
|
int |
size()
|
SortedMap |
subMap(K fromKey, K toKey)
|
SortedMap |
tailMap(K fromKey)
|
String |
toString()
|
static <K |
unmodifiableTrie(Trie
Factory method to create a unmodifiable trie.
|
Collection |
values()
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic UnmodifiableTrie(Trie<K ,? extends V> trie)
trie - the trie to decorate, must not be null
NullPointerException - if trie is null
public static <K,V> Trie <K ,V> unmodifiableTrie(Trie <K ,? extends V> trie)
K - the key type
V - the value type
trie - the trie to decorate, must not be null
NullPointerException - if trie is null
public Collection<V> values()
public void clear()
public boolean containsKey(Objectkey)
containsKey in interface
Map<K,V>
containsKey in interface
Get<K,V>
Map.containsKey(Object)
public boolean containsValue(Objectvalue)
containsValue in interface
Map<K,V>
containsValue in interface
Get<K,V>
Map.containsValue(Object)
public boolean isEmpty()
public V put(K key, V value)
Put
public int size()
public K firstKey()
OrderedMap
public K lastKey()
OrderedMap
public SortedMap<K ,V> prefixMap(K key)
Trie
Trie of all elements that are prefixed by the given key.
In a Trie with fixed size keys, this is essentially a Map operation.
For example, if the Trie contains 'Anna', 'Anael', 'Analu', 'Andreas', 'Andrea', 'Andres', and 'Anatole', then a lookup of 'And' would return 'Andreas', 'Andrea', and 'Andres'.
public Comparator<? super K> comparator()
public OrderedMapIterator<K ,V> mapIterator()
OrderedMap
OrderedMapIterator over the map.
A ordered map iterator is an efficient way of iterating over maps in both directions.
mapIterator in interface
IterableGet<K,V>
mapIterator in interface
OrderedMap<K,V>
public K nextKey(K key)
OrderedMap
nextKey in interface
OrderedMap<K,V>
key - the key to search for next from
public K previousKey(K key)
OrderedMap
previousKey in interface
OrderedMap<K,V>
key - the key to search for previous from
public int hashCode()
public boolean equals(Objectobj)
public StringtoString()