K
- the type of the keys in this mapV
- the type of the values in this mappublic class UnmodifiableTrie<K,V> extends java.lang.Object implements Trie<K,V>, java.io.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() |
java.util.Comparator<? super K> |
comparator() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
boolean |
equals(java.lang.Object obj) |
K |
firstKey()
Gets the first key currently in this map.
|
V |
get(java.lang.Object key) |
int |
hashCode() |
java.util.SortedMap<K,V> |
headMap(K toKey) |
boolean |
isEmpty() |
java.util.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.
|
java.util.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(java.util.Map<? extends K,? extends V> m) |
V |
remove(java.lang.Object key) |
int |
size() |
java.util.SortedMap<K,V> |
subMap(K fromKey,
K toKey) |
java.util.SortedMap<K,V> |
tailMap(K fromKey) |
java.lang.String |
toString() |
static <K,V> Trie<K,V> |
unmodifiableTrie(Trie<K,? extends V> trie)
Factory method to create a unmodifiable trie.
|
java.util.Collection<V> |
values() |
public 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 nulljava.lang.NullPointerException
- if trie is nullpublic java.util.Set<K> keySet()
public java.util.Collection<V> values()
public void clear()
public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public V get(java.lang.Object key)
public boolean isEmpty()
public V put(K key, V value)
Put
put
in interface java.util.Map<K,V>
put
in interface Put<K,V>
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keykey
, or
null
if there was no mapping for key
.
(A null
return can also indicate that the map
previously associated null
with key
,
if the implementation supports null
values.)Map.put(Object, Object)
public V remove(java.lang.Object key)
public int size()
public K firstKey()
OrderedMap
public K lastKey()
OrderedMap
public java.util.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 java.util.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 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(java.lang.Object obj)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2010 - 2020 Adobe. All Rights Reserved