public final class LinkedTreeMap<K,V> extends AbstractMap<K,V> implements Serializable
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.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and 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 by
comparator . |
Modifier and Type | Method and 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() |
clone, containsValue, equals, hashCode, isEmpty, putAll, toString, values
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public LinkedTreeMap()
public LinkedTreeMap(Comparator<? super K> comparator)
comparator
. This map's keys may only be
null if comparator
permits.comparator
- the comparator to order elements with, or null
to
use the natural ordering.public int size()
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
containsKey
in class AbstractMap<K,V>
public void clear()