K
- key type of this mapV
- value type of this mapWK
- key type of wrapped mapWV
- value type of wrapped mappublic class ConvertedNavigableMap<K,V,WK,WV> extends AbstractNavigableMap<K,V>
NavigableMap
using a strictly invertible Converter
.
Supplied Converter
s may throw ClassCastException
or IllegalArgumentException
if given an objects whose runtime type does not match the expected type.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
bounds
Constructor and Description |
---|
ConvertedNavigableMap(NavigableMap<WK,WV> map,
Converter<K,WK> keyConverter,
Converter<V,WV> valueConverter)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Comparator<? super K> |
comparator() |
protected NavigableMap<K,V> |
createSubMap(boolean reverse,
Bounds<K> newBounds)
Create a (possibly reversed) view of this instance with (possibly) tighter lower and/or upper bounds.
|
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key) |
Converter<K,WK> |
getKeyConverter() |
Converter<V,WV> |
getValueConverter() |
boolean |
isEmpty() |
NavigableSet<K> |
navigableKeySet() |
V |
put(K key,
V value) |
V |
remove(Object key)
Removes the mapping for a key from this map if it is present.
|
protected Map.Entry<K,V> |
searchAbove(K minKey,
boolean inclusive)
Search for a higher element.
|
protected Map.Entry<K,V> |
searchBelow(K maxKey,
boolean inclusive)
Search for a lower element.
|
int |
size() |
ceilingEntry, ceilingKey, containsKey, descendingKeySet, descendingMap, firstEntry, firstKey, floorEntry, floorKey, getComparator, headMap, headMap, higherEntry, higherKey, isWithinLowerBound, isWithinUpperBound, keySet, lastEntry, lastKey, lowerEntry, lowerKey, pollFirstEntry, pollLastEntry, subMap, subMap, tailMap, tailMap
clone, containsValue, equals, hashCode, putAll, toString, values
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, containsValue, equals, forEach, getOrDefault, hashCode, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll
public ConvertedNavigableMap(NavigableMap<WK,WV> map, Converter<K,WK> keyConverter, Converter<V,WV> valueConverter)
map
- wrapped mapkeyConverter
- key convertervalueConverter
- value converterIllegalArgumentException
- if any parameter is nullpublic Comparator<? super K> comparator()
public NavigableSet<K> navigableKeySet()
public V remove(Object key)
AbstractNavigableMap
The implementation in AbstractNavigableMap
always throws UnsupportedOperationException
.
public void clear()
public boolean isEmpty()
public int size()
protected Map.Entry<K,V> searchBelow(K maxKey, boolean inclusive)
AbstractNavigableMap
floorEntry()
and lowerEntry()
.
The implementation in AbstractNavigableMap
checks the bounds then returns the first entry from a head map.
searchBelow
in class AbstractNavigableMap<K,V>
maxKey
- upper limit for searchinclusive
- true if maxKey
itself is a candidatemaxKey
, or null if not foundprotected Map.Entry<K,V> searchAbove(K minKey, boolean inclusive)
AbstractNavigableMap
ceilingEntry()
and higherEntry()
.
The implementation in AbstractNavigableMap
checks the bounds then returns the first entry from a tail map.
searchAbove
in class AbstractNavigableMap<K,V>
minKey
- lower limit for searchinclusive
- true if minKey
itself is a candidateminKey
, or null if not foundprotected NavigableMap<K,V> createSubMap(boolean reverse, Bounds<K> newBounds)
AbstractNavigableMap
newBounds
are consistent with the new ordering (i.e., reversed relative to this instance's ordering if
reverse
is true) and have already been range-checked against this instance's current bounds.createSubMap
in class AbstractNavigableMap<K,V>
reverse
- whether the new map's ordering should be reversed relative to this instance's orderingnewBounds
- new boundsCopyright © 2022. All rights reserved.