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:
java.io.Serializable
,java.util.Map<K,V>
public final class LinkedTreeMap<K,V> extends java.util.AbstractMap<K,V> implements java.io.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
-
-
Constructor Summary
Constructors Constructor Description LinkedTreeMap()
Create a natural order, empty tree map whose keys must be mutually comparable and non-null.LinkedTreeMap(java.util.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(java.lang.Object key)
java.util.Set<java.util.Map.Entry<K,V>>
entrySet()
V
get(java.lang.Object key)
java.util.Set<K>
keySet()
V
put(K key, V value)
V
remove(java.lang.Object key)
int
size()
-
Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, isEmpty, putAll, toString, values
-
-
-
-
Constructor Detail
-
LinkedTreeMap
public LinkedTreeMap()
Create a natural order, empty tree map whose keys must be mutually comparable and non-null.
-
LinkedTreeMap
public LinkedTreeMap(java.util.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()
-
get
public V get(java.lang.Object key)
-
containsKey
public boolean containsKey(java.lang.Object key)
-
clear
public void clear()
-
remove
public V remove(java.lang.Object key)
-
-