Top Description Inners Fields Constructors Methods
com.google.common.collect

pack-priv Class MapMakerInternalMap<K, V, E extends MapMakerInternalMap.InternalEntry<K, V, E>, S extends MapMakerInternalMap.Segment<K, V, E, S>>

extends AbstractMap<K, V>
implements ConcurrentMap<K, V>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.util.concurrent.ConcurrentMap, java.util.Map
Annotations
@J2ktIncompatible
@GwtIncompatible
@SuppressWarnings:GuardedBy, nullness
Type Parameters
<K>
the type of the keys in the map
<V>
the type of the values in the map
<E>
the type of the InternalEntry entry implementation used internally
<S>
the type of the Segment entry implementation used internally
Static Imports
com.google.common.base.Preconditions.checkNotNull, com.google.common.collect.CollectPreconditions.checkRemove

The concurrent hash map implementation built by MapMaker.

This implementation is heavily derived from revision 1.96 of ConcurrentHashMap.java.

Authors
Bob Lee, Charles Fry, Doug Lea (ConcurrentHashMap)

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv abstract static class
MapMakerInternalMap.AbstractSerializationProxy<K, V>

The actual object that gets serialized.

pack-priv abstract static class
MapMakerInternalMap.AbstractStrongKeyEntry<K, V, E extends MapMakerInternalMap.InternalEntry<K, V, E>>

Base class for InternalEntry implementations for strong keys.

pack-priv abstract static class
MapMakerInternalMap.AbstractWeakKeyEntry<K, V, E extends MapMakerInternalMap.InternalEntry<K, V, E>>

Base class for InternalEntry implementations for weak keys.

pack-priv static class
pack-priv static class
MapMakerInternalMap.DummyInternalEntry

A dummy implementation of InternalEntry, solely for use in the type signature of UNSET_WEAK_VALUE_REFERENCE below.

pack-priv class
pack-priv class
pack-priv abstract class
pack-priv static interface
MapMakerInternalMap.InternalEntry<K, V, E extends MapMakerInternalMap.InternalEntry<K, V, E>>

An entry in a hash table of a Segment.

pack-priv static interface
MapMakerInternalMap.InternalEntryHelper<
the type of the key in each entry
K
,
the type of the value in each entry
V
,
the type of the InternalEntry entry implementation
E extends MapMakerInternalMap.InternalEntry<K, V, E>
,
the type of the Segment entry implementation
S extends MapMakerInternalMap.Segment<K, V, E, S>
>

A helper object for operating on InternalEntry instances in a type-safe and efficient manner.

pack-priv class
pack-priv class
private abstract static class
pack-priv abstract static class
MapMakerInternalMap.Segment<K, V, E extends MapMakerInternalMap.InternalEntry<K, V, E>, S extends MapMakerInternalMap.Segment<K, V, E, S>>

Segments are specialized versions of hash tables.

private static class
MapMakerInternalMap.SerializationProxy<K, V>

The actual object that gets serialized.

pack-priv static enum
pack-priv static class
MapMakerInternalMap.StrongKeyDummyValueEntry<K>

Concrete implementation of InternalEntry for strong keys and Dummy values.

pack-priv static class
MapMakerInternalMap.StrongKeyDummyValueSegment<K>

Concrete implementation of Segment for strong keys and Dummy values.

pack-priv static class
MapMakerInternalMap.StrongKeyStrongValueEntry<K, V>

Concrete implementation of InternalEntry for strong keys and strong values.

pack-priv static class
MapMakerInternalMap.StrongKeyStrongValueSegment<K, V>

Concrete implementation of Segment for strong keys and strong values.

pack-priv static class
MapMakerInternalMap.StrongKeyWeakValueEntry<K, V>

Concrete implementation of InternalEntry for strong keys and weak values.

pack-priv static class
MapMakerInternalMap.StrongKeyWeakValueSegment<K, V>

Concrete implementation of Segment for strong keys and weak values.

pack-priv static interface
MapMakerInternalMap.StrongValueEntry<K, V, E extends MapMakerInternalMap.InternalEntry<K, V, E>>

Marker interface for InternalEntry implementations for strong values.

pack-priv class
pack-priv class
pack-priv static class
MapMakerInternalMap.WeakKeyDummyValueEntry<K>

Concrete implementation of InternalEntry for weak keys and Dummy values.

pack-priv static class
MapMakerInternalMap.WeakKeyDummyValueSegment<K>

Concrete implementation of Segment for weak keys and Dummy values.

pack-priv static class
MapMakerInternalMap.WeakKeyStrongValueEntry<K, V>

Concrete implementation of InternalEntry for weak keys and strong values.

pack-priv static class
MapMakerInternalMap.WeakKeyStrongValueSegment<K, V>

Concrete implementation of Segment for weak keys and strong values.

pack-priv static class
MapMakerInternalMap.WeakKeyWeakValueEntry<K, V>

Concrete implementation of InternalEntry for weak keys and weak values.

pack-priv static class
MapMakerInternalMap.WeakKeyWeakValueSegment<K, V>

Concrete implementation of Segment for weak keys and weak values.

pack-priv static interface
MapMakerInternalMap.WeakValueEntry<K, V, E extends MapMakerInternalMap.InternalEntry<K, V, E>>

Marker interface for InternalEntry implementations for weak values.

pack-priv static interface
MapMakerInternalMap.WeakValueReference<K, V, E extends MapMakerInternalMap.InternalEntry<K, V, E>>

A weakly referenced value that also has a reference to its containing entry.

pack-priv static class
pack-priv class
MapMakerInternalMap.WriteThroughEntry

Custom Entry class used by EntryIterator.next(), that relays setValue changes to the underlying map.

Field Summary

Modifier and TypeField and Description
pack-priv final int
concurrencyLevel

The concurrency level.

pack-priv static final int
CONTAINS_VALUE_RETRIES

Number of (unsynchronized) retries in the containsValue method.

pack-priv static final int
DRAIN_MAX

Maximum number of entries to be drained in a single cleanup run.

pack-priv static final int
DRAIN_THRESHOLD

Number of cache access operations that can be buffered per segment before the cache's recency ordering information is updated.

pack-priv final transient MapMakerInternalMap.InternalEntryHelper<K, V, E, S>
entryHelper

Strategy for handling entries and segments in a type-safe and efficient manner.

pack-priv transient Set<Map.Entry<K, V>>
pack-priv final Equivalence<Object>
keyEquivalence

Strategy for comparing keys.

pack-priv transient Set<K>
pack-priv static final int
MAX_SEGMENTS

The maximum number of segments to allow; used to bound constructor arguments.

pack-priv static final int
MAXIMUM_CAPACITY

The maximum capacity, used if a higher value is implicitly specified by either of the constructors with arguments.

pack-priv final transient int
segmentMask

Mask value for indexing into segments.

pack-priv final transient MapMakerInternalMap.Segment<K, V, E, S>[]
segments

The segments, each of which is a specialized hash table.

pack-priv final transient int
segmentShift

Shift value for indexing within segments.

private static final long
pack-priv static final MapMakerInternalMap.WeakValueReference<Object, Object, MapMakerInternalMap.DummyInternalEntry>
UNSET_WEAK_VALUE_REFERENCE

A singleton WeakValueReference used to denote an unset value in an entry with weak values.

pack-priv transient Collection<V>

Constructor Summary

AccessConstructor and Description
private
MapMakerInternalMap(MapMaker builder, MapMakerInternalMap.InternalEntryHelper<K, V, E, S> entryHelper)

Creates a new, empty map with the specified strategy, initial capacity and concurrency level.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Overrides java.util.AbstractMap.clear.

Implements java.util.Map.clear.

Removes all of the mappings from this map (optional operation).
public boolean
containsKey(Object
key whose presence in this map is to be tested
key
)

Overrides java.util.AbstractMap.containsKey.

Implements java.util.Map.containsKey.

Returns true if this map contains a mapping for the specified key.
public boolean
containsValue(Object
value whose presence in this map is to be tested
value
)

Overrides java.util.AbstractMap.containsValue.

Implements java.util.Map.containsValue.

Returns true if this map maps one or more keys to the specified value.
pack-priv E
copyEntry(E original, E newNext)

This method is a convenience for testing.

pack-priv static <K, V> MapMakerInternalMap<K, V, ? extends MapMakerInternalMap.InternalEntry<K, V, ?>, ?>
create(MapMaker builder)

Returns a fresh MapMakerInternalMap as specified by the given builder.

pack-priv MapMakerInternalMap.Segment<K, V, E, S>
createSegment(int initialCapacity)

pack-priv static <K> MapMakerInternalMap<K, MapMaker.Dummy, ? extends MapMakerInternalMap.InternalEntry<K, MapMaker.Dummy, ?>, ?>
createWithDummyValues(MapMaker builder)

Returns a fresh MapMakerInternalMap with MapMaker.Dummy values but otherwise as specified by the given builder.

public Set<Map.Entry<K, V>>
entrySet()

Implements abstract java.util.AbstractMap.entrySet.

Implements java.util.Map.entrySet.

Returns a Set view of the mappings contained in this map.
public V
get(Object
the key whose associated value is to be returned
key
)

Overrides java.util.AbstractMap.get.

Implements java.util.Map.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
pack-priv E
getEntry(Object key)

Returns the internal entry for the specified key.

pack-priv V
getLiveValue(E entry)

Gets the value from an entry.

pack-priv int
hash(Object key)

public boolean
isEmpty()

Overrides java.util.AbstractMap.isEmpty.

Implements java.util.Map.isEmpty.

Returns true if this map contains no key-value mappings.
pack-priv boolean
isLiveForTesting(MapMakerInternalMap.InternalEntry<K, V, ?> entry)

This method is a convenience for testing.

public Set<K>
keySet()

Overrides java.util.AbstractMap.keySet.

Implements java.util.Map.keySet.

Returns a Set view of the keys contained in this map.
pack-priv MapMakerInternalMap.Strength
pack-priv final MapMakerInternalMap.Segment<K, V, E, S>[]
newSegmentArray(int ssize)

public V
put(K
key with which the specified value is to be associated
key
,
V
value to be associated with the specified key
value
)

Overrides java.util.AbstractMap.put.

Implements java.util.Map.put.

Associates the specified value with the specified key in this map (optional operation).
public void
putAll(Map<? extends K, ? extends V>
mappings to be stored in this map
m
)

Overrides java.util.AbstractMap.putAll.

Implements java.util.Map.putAll.

Copies all of the mappings from the specified map to this map (optional operation).
public V
putIfAbsent(K
key with which the specified value is to be associated
key
,
V
value to be associated with the specified key
value
)

Overrides default java.util.Map.putIfAbsent.

Implements java.util.concurrent.ConcurrentMap.putIfAbsent.

If the specified key is not already associated with a value, associates it with the given value.
private void
pack-priv void
reclaimKey(E entry)

pack-priv void
pack-priv static int
rehash(int
hash code
h
)

Applies a supplemental hash function to a given hash code, which defends against poor quality hash functions.

public V
remove(Object
key whose mapping is to be removed from the map
key
)

Overrides java.util.AbstractMap.remove.

Implements java.util.Map.remove.

Removes the mapping for a key from this map if it is present (optional operation).
public boolean
remove(Object
key with which the specified value is associated
key
,
Object
value expected to be associated with the specified key
value
)

Overrides default java.util.Map.remove.

Implements java.util.concurrent.ConcurrentMap.remove.

Removes the entry for a key only if currently mapped to a given value.
public boolean
replace(K
key with which the specified value is associated
key
,
V
value expected to be associated with the specified key
oldValue
,
V
value to be associated with the specified key
newValue
)

Overrides default java.util.Map.replace.

Implements java.util.concurrent.ConcurrentMap.replace.

Replaces the entry for a key only if currently mapped to a given value.
public V
replace(K
key with which the specified value is associated
key
,
V
value to be associated with the specified key
value
)

Overrides default java.util.Map.replace.

Implements java.util.concurrent.ConcurrentMap.replace.

Replaces the entry for a key only if currently mapped to some value.
pack-priv MapMakerInternalMap.Segment<K, V, E, S>

Returns:

the segment
segmentFor
(int
the hash code for the key
hash
)

Returns the segment that should be used for a key with the given hash.

public int
size()

Overrides java.util.AbstractMap.size.

Implements java.util.Map.size.

Returns the number of key-value mappings in this map.
private static <E> ArrayList<E>
pack-priv static <K, V, E extends MapMakerInternalMap.InternalEntry<K, V, E>> MapMakerInternalMap.WeakValueReference<K, V, E>
pack-priv Equivalence<Object>
public Collection<V>
values()

Overrides java.util.AbstractMap.values.

Implements java.util.Map.values.

Returns a Collection view of the values contained in this map.
pack-priv MapMakerInternalMap.Strength
pack-priv Object
Inherited from java.util.AbstractMap:
cloneequalshashCodetoString