Package io.github.connellite.collections
Class NullSkippingTreeMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.TreeMap<K,V>
io.github.connellite.collections.NullSkippingTreeMap<K,V>
- All Implemented Interfaces:
Serializable,Cloneable,Map<K,,V> NavigableMap<K,,V> SortedMap<K,V>
TreeMap that ignores put / putAll / putIfAbsent / merge when the key is null (no-op; avoids throwing on insert).- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
ConstructorsConstructorDescriptionNullSkippingTreeMap(Comparator<? super K> comparator) NullSkippingTreeMap(Map<? extends K, ? extends V> m) NullSkippingTreeMap(SortedMap<K, ? extends V> m) -
Method Summary
Modifier and TypeMethodDescriptionMerges value for a non-null key.Associates value with a non-null key.voidCopies all entries with non-null keys from the input map.putIfAbsent(K key, V value) Stores value for a non-null key only when absent.Methods inherited from class java.util.TreeMap
ceilingEntry, ceilingKey, clear, clone, comparator, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, forEach, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, remove, replace, replace, replaceAll, size, subMap, subMap, tailMap, tailMap, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
-
Constructor Details
-
NullSkippingTreeMap
public NullSkippingTreeMap() -
NullSkippingTreeMap
-
NullSkippingTreeMap
-
NullSkippingTreeMap
-
-
Method Details
-
put
Associates value with a non-null key. -
putAll
Copies all entries with non-null keys from the input map. -
putIfAbsent
Stores value for a non-null key only when absent.- Specified by:
putIfAbsentin interfaceMap<K,V> - Overrides:
putIfAbsentin classTreeMap<K,V> - Parameters:
key- map keyvalue- map value- Returns:
- existing value or
null
-
merge
Merges value for a non-null key.
-