@GwtCompatible abstract static class Maps.ImprovedAbstractMap<K,V> extends java.util.AbstractMap<K,V>
AbstractMap
extension that implements AbstractMap.isEmpty()
as entrySet().isEmpty()
instead of size() == 0
to speed up
implementations where size()
is O(n), and it delegates the isEmpty()
methods of its key set and value collection to this
implementation.Modifier and Type | Field and Description |
---|---|
private java.util.Set<java.util.Map.Entry<K,V>> |
entrySet |
private java.util.Set<K> |
keySet |
private java.util.Collection<V> |
values |
Constructor and Description |
---|
ImprovedAbstractMap() |
Modifier and Type | Method and Description |
---|---|
(package private) abstract java.util.Set<java.util.Map.Entry<K,V>> |
createEntrySet()
Creates the entry set to be returned by
entrySet() . |
(package private) java.util.Set<K> |
createKeySet() |
(package private) java.util.Collection<V> |
createValues() |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
java.util.Set<K> |
keySet() |
java.util.Collection<V> |
values() |
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, put, putAll, remove, size, toString
private transient java.util.Set<K> keySet
private transient java.util.Collection<V> values
abstract java.util.Set<java.util.Map.Entry<K,V>> createEntrySet()
entrySet()
. This method
is invoked at most once on a given map, at the time when entrySet
is first called.public java.util.Set<K> keySet()
java.util.Set<K> createKeySet()
public java.util.Collection<V> values()
java.util.Collection<V> createValues()