Package com.google.gson.internal
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>
public final class LinkedTreeMap<K,V> extends AbstractMap<K,V> implements Serializable
A map of comparable keys to values. UnlikeTreeMap
, 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:
- Serialized Form
-
-
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
Constructors Constructor Description LinkedTreeMap()
Create a natural order, empty tree map whose keys must be mutually comparable and non-null.LinkedTreeMap(Comparator<? super K> comparator)
Create a tree map ordered bycomparator
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
containsKey(Object key)
Set<Map.Entry<K,V>>
entrySet()
V
get(Object key)
Set<K>
keySet()
V
put(K key, V value)
V
remove(Object key)
int
size()
-
Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, isEmpty, putAll, toString, values
-
Methods inherited from class java.lang.Object
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
-
LinkedTreeMap
public LinkedTreeMap()
Create a natural order, empty tree map whose keys must be mutually comparable and non-null.
-
LinkedTreeMap
public LinkedTreeMap(Comparator<? super K> comparator)
Create a tree map ordered bycomparator
. This map's keys may only be null ifcomparator
permits.- Parameters:
comparator
- the comparator to order elements with, ornull
to use the natural ordering.
-
-
Method Detail
-
size
public int size()
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interfaceMap<K,V>
- Overrides:
containsKey
in classAbstractMap<K,V>
-
clear
public void clear()
-
-