public class SharedKeyMap<K,V> extends AbstractMap<K,V> implements Serializable
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
SharedKeyMap()
Creates an empty, isolated SharedKeyMap.
|
SharedKeyMap(int initialValueCapacity)
Creates an empty, isolated SharedKeyMap, with control over
the initial size of the values array.
|
SharedKeyMap(Map<K,Integer> keyToIndex,
int initialValueCapacity)
Creates an empty, isolated SharedKeyMap, with control over
the key-to-index value map and also initial size of the values array.
|
SharedKeyMap(SharedKeyMap<K,? extends V> map)
Creates a new shared key map that shares the keymap of map.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears out the values in this instance of a SharedKeyMap; does not affect the contents of
the key-to-index map.
|
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
static <K,V> List<SharedKeyMap<K,V>> |
createEmptySharedKeyMaps(int numberOfMaps)
Creates a list of empty SharedKeyMaps that all share a single (empty) key map.
|
static <K,V> List<SharedKeyMap<K,V>> |
createEmptySharedKeyMaps(int numberOfMaps,
SharedKeyMap<K,V> map)
Creates a list of empty SharedKeyMaps that all use the key map of the specified SharedKeyMap.
|
static <K,V> List<SharedKeyMap<K,V>> |
createEmptySharedKeyMaps(List<K> keys,
int numberOfMaps)
Creates a list of empty SharedKeyMaps that all use the specified keys.
|
static <K,V> List<SharedKeyMap<K,V>> |
createSharedKeyMaps(List<Map<K,V>> maps)
Takes a list of Maps and returns a list of SharedKeyMaps with the same mappings and values.
|
static <K,V> List<SharedKeyMap<K,V>> |
createSharedKeyMaps(List<Map<K,V>> maps,
boolean removeFromList)
Takes a list of Maps and returns a list of SharedKeyMaps with the same mappings and values.
|
Set<Map.Entry<K,V>> |
entrySet()
The getKey function on the MapEntries returned by this iterator takes O(keys) time,
so don't call it if you can avoid it.
|
V |
get(Object key) |
int |
keyMapSize()
Returns the number of entries in the keymap.
|
Set<K> |
keySet() |
V |
put(K key,
V value) |
V |
remove(Object key) |
int |
size() |
void |
trimToSize() |
clone, equals, hashCode, isEmpty, putAll, toString, valuesfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic SharedKeyMap(SharedKeyMap<K,? extends V> map)
public SharedKeyMap()
public SharedKeyMap(int initialValueCapacity)
initialValueCapacity - if this is non-negative, then its used as
the initial size for the values array. If its negative, then
this SharedKeyMap cannot have any values stored in it.public SharedKeyMap(Map<K,Integer> keyToIndex, int initialValueCapacity)
keyToIndex - maps keys to their index in the values array. This
structure is shared across threads.initialValueCapacity - if this is non-negative, then its used as
the initial size for the values array. If its negative, then
this SharedKeyMap cannot have any values stored in it.public static <K,V> List<SharedKeyMap<K,V>> createSharedKeyMaps(List<Map<K,V>> maps)
maps - - the maps to re-create as SharedKeyMapspublic static <K,V> List<SharedKeyMap<K,V>> createSharedKeyMaps(List<Map<K,V>> maps, boolean removeFromList)
maps - - the maps to re-create as SharedKeyMapsremoveFromList - - remove the passed-in maps from the list as they are processed, so they can be garbage collected.public static <K,V> List<SharedKeyMap<K,V>> createEmptySharedKeyMaps(List<K> keys, int numberOfMaps)
keys - - the keys that all your maps will (likely) usenumberOfMaps - - the number of maps this function will create for youpublic static <K,V> List<SharedKeyMap<K,V>> createEmptySharedKeyMaps(int numberOfMaps)
numberOfMaps - - the number of maps this function will create for youpublic static <K,V> List<SharedKeyMap<K,V>> createEmptySharedKeyMaps(int numberOfMaps, SharedKeyMap<K,V> map)
numberOfMaps - - the number of maps this function will create for youpublic int size()
public void trimToSize()
public boolean containsKey(Object key)
containsKey in interface Map<K,V>containsKey in class AbstractMap<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>containsValue in class AbstractMap<K,V>public void clear()
public Set<Map.Entry<K,V>> entrySet()
public int keyMapSize()
Copyright (c) 2016-2017, Salesforce.com, Inc. All rights reserved. Licensed under the BSD 3-Clause license. For full license text, see the LICENSE.txt file in the repository.