Class LinkedTreeMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
com.google.gson.internal.LinkedTreeMap<K,V>
- All Implemented Interfaces:
Serializable, Map<K,V>
A map of comparable keys to values. Unlike
TreeMap, this class uses insertion order for
iteration order. Comparison order is only used as an optimization for efficient insertion and
removal.
This implementation was derived from Android 4.1's TreeMap class.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
ConstructorsConstructorDescriptionCreate a natural order, empty tree map whose keys must be mutually comparable and non-null, and whose values can benull.LinkedTreeMap(boolean allowNullValues) Create a natural order, empty tree map whose keys must be mutually comparable and non-null.LinkedTreeMap(Comparator<? super K> comparator, boolean allowNullValues) Create a tree map ordered bycomparator. -
Method Summary
Methods inherited from class AbstractMap
clone, containsValue, equals, hashCode, isEmpty, putAll, toString, valuesMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
LinkedTreeMap
public LinkedTreeMap()Create a natural order, empty tree map whose keys must be mutually comparable and non-null, and whose values can benull. -
LinkedTreeMap
public LinkedTreeMap(boolean allowNullValues) Create a natural order, empty tree map whose keys must be mutually comparable and non-null.- Parameters:
allowNullValues- whethernullis allowed as entry value
-
LinkedTreeMap
Create a tree map ordered bycomparator. This map's keys may only be null ifcomparatorpermits.- Parameters:
comparator- the comparator to order elements with, ornullto use the natural ordering.allowNullValues- whethernullis allowed as entry value
-
-
Method Details
-
size
-
get
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V>
-
put
-
clear
-
remove
-
entrySet
-
keySet
-