Class SafeTreeMap<K,V>
- java.lang.Object
-
- com.google.common.collect.testing.SafeTreeMap<K,V>
-
- All Implemented Interfaces:
Serializable,Map<K,V>,NavigableMap<K,V>,SortedMap<K,V>
@GwtIncompatible public final class SafeTreeMap<K,V> extends Object implements Serializable, NavigableMap<K,V>
A wrapper aroundTreeMapthat aggressively checks to see if keys are mutually comparable. This implementation passes the navigable map test suites.- Author:
- Louis Wasserman
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SafeTreeMap()SafeTreeMap(Comparator<? super K> comparator)SafeTreeMap(Map<? extends K,? extends V> map)SafeTreeMap(SortedMap<K,? extends V> map)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable Map.Entry<K,V>ceilingEntry(K key)@Nullable KceilingKey(K key)voidclear()Comparator<? super K>comparator()booleancontainsKey(Object key)booleancontainsValue(Object value)NavigableSet<K>descendingKeySet()NavigableMap<K,V>descendingMap()Set<Map.Entry<K,V>>entrySet()booleanequals(@Nullable Object obj)@Nullable Map.Entry<K,V>firstEntry()KfirstKey()@Nullable Map.Entry<K,V>floorEntry(K key)@Nullable KfloorKey(K key)@Nullable Vget(Object key)inthashCode()SortedMap<K,V>headMap(K toKey)NavigableMap<K,V>headMap(K toKey, boolean inclusive)@Nullable Map.Entry<K,V>higherEntry(K key)@Nullable KhigherKey(K key)booleanisEmpty()NavigableSet<K>keySet()@Nullable Map.Entry<K,V>lastEntry()KlastKey()@Nullable Map.Entry<K,V>lowerEntry(K key)@Nullable KlowerKey(K key)NavigableSet<K>navigableKeySet()@Nullable Map.Entry<K,V>pollFirstEntry()@Nullable Map.Entry<K,V>pollLastEntry()@Nullable Vput(K key, V value)voidputAll(Map<? extends K,? extends V> map)@Nullable Vremove(Object key)intsize()NavigableMap<K,V>subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)SortedMap<K,V>subMap(K fromKey, K toKey)SortedMap<K,V>tailMap(K fromKey)NavigableMap<K,V>tailMap(K fromKey, boolean inclusive)StringtoString()Collection<V>values()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
SafeTreeMap
public SafeTreeMap()
-
SafeTreeMap
public SafeTreeMap(Comparator<? super K> comparator)
-
SafeTreeMap
public SafeTreeMap(Map<? extends K,? extends V> map)
-
SafeTreeMap
public SafeTreeMap(SortedMap<K,? extends V> map)
-
-
Method Detail
-
ceilingEntry
public @Nullable Map.Entry<K,V> ceilingEntry(K key)
- Specified by:
ceilingEntryin interfaceNavigableMap<K,V>
-
ceilingKey
public @Nullable K ceilingKey(K key)
- Specified by:
ceilingKeyin interfaceNavigableMap<K,V>
-
comparator
public Comparator<? super K> comparator()
- Specified by:
comparatorin interfaceSortedMap<K,V>
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<K,V>
-
descendingKeySet
public NavigableSet<K> descendingKeySet()
- Specified by:
descendingKeySetin interfaceNavigableMap<K,V>
-
descendingMap
public NavigableMap<K,V> descendingMap()
- Specified by:
descendingMapin interfaceNavigableMap<K,V>
-
firstEntry
public @Nullable Map.Entry<K,V> firstEntry()
- Specified by:
firstEntryin interfaceNavigableMap<K,V>
-
floorEntry
public @Nullable Map.Entry<K,V> floorEntry(K key)
- Specified by:
floorEntryin interfaceNavigableMap<K,V>
-
headMap
public NavigableMap<K,V> headMap(K toKey, boolean inclusive)
- Specified by:
headMapin interfaceNavigableMap<K,V>
-
higherEntry
public @Nullable Map.Entry<K,V> higherEntry(K key)
- Specified by:
higherEntryin interfaceNavigableMap<K,V>
-
higherKey
public @Nullable K higherKey(K key)
- Specified by:
higherKeyin interfaceNavigableMap<K,V>
-
keySet
public NavigableSet<K> keySet()
-
lastEntry
public @Nullable Map.Entry<K,V> lastEntry()
- Specified by:
lastEntryin interfaceNavigableMap<K,V>
-
lowerEntry
public @Nullable Map.Entry<K,V> lowerEntry(K key)
- Specified by:
lowerEntryin interfaceNavigableMap<K,V>
-
navigableKeySet
public NavigableSet<K> navigableKeySet()
- Specified by:
navigableKeySetin interfaceNavigableMap<K,V>
-
pollFirstEntry
public @Nullable Map.Entry<K,V> pollFirstEntry()
- Specified by:
pollFirstEntryin interfaceNavigableMap<K,V>
-
pollLastEntry
public @Nullable Map.Entry<K,V> pollLastEntry()
- Specified by:
pollLastEntryin interfaceNavigableMap<K,V>
-
subMap
public NavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
- Specified by:
subMapin interfaceNavigableMap<K,V>
-
tailMap
public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive)
- Specified by:
tailMapin interfaceNavigableMap<K,V>
-
values
public Collection<V> values()
-
hashCode
public int hashCode()
-
-