public class UnmodifiableTrie<K,V> extends Object implements Trie<K,V>, Serializable, Unmodifiable
Trie
.Constructor and Description |
---|
UnmodifiableTrie(Trie<K,? extends V> trie)
Constructor that wraps (not copies).
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Comparator<? super K> |
comparator() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object obj) |
K |
firstKey()
Gets the first key currently in this map.
|
V |
get(Object key) |
int |
hashCode() |
SortedMap<K,V> |
headMap(K toKey) |
boolean |
isEmpty() |
Set<K> |
keySet() |
K |
lastKey()
Gets the last key currently in this map.
|
OrderedMapIterator<K,V> |
mapIterator()
Obtains an
OrderedMapIterator over the map. |
K |
nextKey(K key)
Gets the next key after the one specified.
|
SortedMap<K,V> |
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<? extends K,? extends V> m) |
V |
remove(Object key) |
int |
size() |
SortedMap<K,V> |
subMap(K fromKey,
K toKey) |
SortedMap<K,V> |
tailMap(K fromKey) |
String |
toString() |
static <K,V> Trie<K,V> |
unmodifiableTrie(Trie<K,? extends V> trie)
Factory method to create a unmodifiable trie.
|
Collection<V> |
values() |
public UnmodifiableTrie(Trie<K,? extends V> trie)
trie
- the trie to decorate, must not be nullIllegalArgumentException
- if trie is nullpublic static <K,V> Trie<K,V> unmodifiableTrie(Trie<K,? extends V> trie)
K
- the key typeV
- the value typetrie
- the trie to decorate, must not be nullIllegalArgumentException
- if trie is nullpublic Collection<V> values()
public void clear()
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
containsKey
in interface Get<K,V>
Map.containsKey(Object)
public boolean containsValue(Object value)
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.get(Object)
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()
comparator
in interface SortedMap<K,V>
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 frompublic K previousKey(K key)
OrderedMap
previousKey
in interface OrderedMap<K,V>
key
- the key to search for previous frompublic int hashCode()
public boolean equals(Object obj)
Copyright © 2001–2013 The Apache Software Foundation. All rights reserved.