public class UnifiedMapWithHashingStrategy<K,V> extends AbstractMutableMap<K,V> implements Externalizable, BatchIterable<V>
The difference between UnifiedMap and UnifiedMapWithHashingStrategy is that a HashingStrategy based UnifiedMap does not rely on the hashCode or equality of the object at the key, but instead relies on a HashingStrategy implementation provided by a developer to compute the hashCode and equals for the objects stored in the map.
| Constructor and Description |
|---|
UnifiedMapWithHashingStrategy()
Deprecated.
No argument default constructor used for serialization. Instantiating an UnifiedMapWithHashingStrategyMultimap with
this constructor will have a null hashingStrategy and throw NullPointerException when used.
|
UnifiedMapWithHashingStrategy(HashingStrategy<? super K> hashingStrategy) |
UnifiedMapWithHashingStrategy(HashingStrategy<? super K> hashingStrategy,
int initialCapacity) |
UnifiedMapWithHashingStrategy(HashingStrategy<? super K> hashingStrategy,
int initialCapacity,
float loadFactor) |
UnifiedMapWithHashingStrategy(HashingStrategy<? super K> hashingStrategy,
Map<? extends K,? extends V> map) |
UnifiedMapWithHashingStrategy(HashingStrategy<? super K> hashingStrategy,
Pair<K,V>... pairs) |
| Modifier and Type | Method and Description |
|---|---|
void |
batchForEach(Procedure<? super V> procedure,
int sectionIndex,
int sectionCount) |
void |
clear() |
UnifiedMapWithHashingStrategy<K,V> |
clone() |
<E> MutableMap<K,V> |
collectKeysAndValues(Iterable<E> iterable,
Function<? super E,? extends K> keyFunction,
Function<? super E,? extends V> valueFunction) |
<R> MutableMap<K,R> |
collectValues(Function2<? super K,? super V,? extends R> function) |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object object) |
void |
forEachKey(Procedure<? super K> procedure) |
void |
forEachKeyValue(Procedure2<? super K,? super V> procedure) |
void |
forEachValue(Procedure<? super V> procedure) |
<P> void |
forEachWith(Procedure2<? super V,? super P> procedure,
P parameter) |
void |
forEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure) |
V |
get(Object key) |
int |
getBatchCount(int batchSize) |
int |
getCollidingBuckets() |
V |
getFirst() |
V |
getIfAbsentPut(K key,
Function0<? extends V> function) |
V |
getIfAbsentPut(K key,
V value) |
<P> V |
getIfAbsentPutWith(K key,
Function<? super P,? extends V> function,
P parameter) |
int |
getMapMemoryUsedInWords()
Returns the number of JVM words that is used by this map.
|
int |
hashCode() |
HashingStrategy<? super K> |
hashingStrategy() |
boolean |
isEmpty() |
Set<K> |
keySet() |
MutableMap<K,V> |
newEmpty() |
MutableMap<K,V> |
newEmpty(int capacity)
Creates a new instance of the same type, using the given capacity and the default growth parameters.
|
static <K,V> UnifiedMapWithHashingStrategy<K,V> |
newMap(HashingStrategy<? super K> hashingStrategy) |
static <K,V> UnifiedMapWithHashingStrategy<K,V> |
newMap(HashingStrategy<? super K> hashingStrategy,
int size) |
static <K,V> UnifiedMapWithHashingStrategy<K,V> |
newMap(HashingStrategy<? super K> hashingStrategy,
int size,
float loadFactor) |
static <K,V> UnifiedMapWithHashingStrategy<K,V> |
newMap(HashingStrategy<? super K> hashingStrategy,
Map<? extends K,? extends V> map) |
static <K,V> UnifiedMapWithHashingStrategy<K,V> |
newMap(UnifiedMapWithHashingStrategy<K,V> map) |
static <K,V> UnifiedMapWithHashingStrategy<K,V> |
newMapWith(HashingStrategy<? super K> hashingStrategy,
Iterable<Pair<K,V>> inputIterable) |
static <K,V> UnifiedMapWithHashingStrategy<K,V> |
newMapWith(HashingStrategy<? super K> hashingStrategy,
Pair<K,V>... pairs) |
static <K,V> UnifiedMapWithHashingStrategy<K,V> |
newWithKeysValues(HashingStrategy<? super K> hashingStrategy,
K key,
V value) |
static <K,V> UnifiedMapWithHashingStrategy<K,V> |
newWithKeysValues(HashingStrategy<? super K> hashingStrategy,
K key1,
V value1,
K key2,
V value2) |
static <K,V> UnifiedMapWithHashingStrategy<K,V> |
newWithKeysValues(HashingStrategy<? super K> hashingStrategy,
K key1,
V value1,
K key2,
V value2,
K key3,
V value3) |
static <K,V> UnifiedMapWithHashingStrategy<K,V> |
newWithKeysValues(HashingStrategy<? super K> hashingStrategy,
K key1,
V value1,
K key2,
V value2,
K key3,
V value3,
K key4,
V value4) |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> map) |
void |
readExternal(ObjectInput in) |
V |
remove(Object key) |
V |
removeKey(K key) |
int |
size() |
ImmutableMap<K,V> |
toImmutable() |
String |
toString()
Returns a string with the elements of the iterable separated by commas with spaces and
enclosed in square brackets.
|
boolean |
trimToSize() |
V |
updateValue(K key,
Function0<? extends V> factory,
Function<? super V,? extends V> function) |
<P> V |
updateValueWith(K key,
Function0<? extends V> factory,
Function2<? super V,? super P,? extends V> function,
P parameter) |
Collection<V> |
values() |
UnifiedMapWithHashingStrategy<K,V> |
withKeysValues(K key,
V value) |
UnifiedMapWithHashingStrategy<K,V> |
withKeysValues(K key1,
V value1,
K key2,
V value2) |
UnifiedMapWithHashingStrategy<K,V> |
withKeysValues(K key1,
V value1,
K key2,
V value2,
K key3,
V value3) |
UnifiedMapWithHashingStrategy<K,V> |
withKeysValues(K key1,
V value1,
K key2,
V value2,
K key3,
V value3,
K key4,
V value4) |
void |
writeExternal(ObjectOutput out) |
asSynchronized, asUnmodifiable, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, flatCollect, flip, groupBy, groupByEach, groupByUniqueKey, partition, partitionWith, reject, reject, rejectWith, select, select, selectInstancesOf, selectWith, tap, withAllKeyValueArguments, withAllKeyValues, withKeyValue, withoutAllKeys, withoutKey, zip, zipWithIndexaggregateBy, collect, countBy, countByEach, countByWith, detect, detectOptional, flipUniqueValues, getIfAbsentPutWithKey, iterator, keysView, keyValuesView, sumByDouble, sumByFloat, sumByInt, sumByLong, valuesViewallSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, asLazy, chunk, contains, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, getIfAbsent, getIfAbsentValue, getIfAbsentWith, getLast, getOnly, getOrDefault, ifPresentApply, noneSatisfy, noneSatisfyWith, toArray, toArrayappendString, appendString, collect, collectIf, collectWith, containsAll, containsAllArguments, containsAllIterable, count, countWith, flatCollect, forEach, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, max, max, maxBy, min, min, minBy, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBag, toBiMap, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndexforEachaggregateBy, aggregateBy, aggregateInPlaceBy, collect, flatCollectWith, flipUniqueValues, withMap, withMapIterableadd, countBy, countByEach, countByWith, getIfAbsentPutWithKey, getOrDefault, putAllMapIterable, putPair, removeAllKeys, removeIf, sumByDouble, sumByFloat, sumByInt, sumByLongcompute, computeIfAbsent, computeIfPresent, forEach, merge, putIfAbsent, remove, replace, replace, replaceAlldetect, detectOptional, getIfAbsent, getIfAbsentValue, getIfAbsentWith, ifPresentApply, injectIntoKeyValue, keysView, keyValuesView, parallelStream, spliterator, stream, valuesViewaggregateBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, count, countBy, countByEach, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, getLast, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, into, makeString, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toImmutableBag, toImmutableBiMap, toImmutableList, toImmutableMap, toImmutableSet, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndexforEach@Deprecated public UnifiedMapWithHashingStrategy()
public UnifiedMapWithHashingStrategy(HashingStrategy<? super K> hashingStrategy)
public UnifiedMapWithHashingStrategy(HashingStrategy<? super K> hashingStrategy, int initialCapacity)
public UnifiedMapWithHashingStrategy(HashingStrategy<? super K> hashingStrategy, int initialCapacity, float loadFactor)
public UnifiedMapWithHashingStrategy(HashingStrategy<? super K> hashingStrategy, Map<? extends K,? extends V> map)
public UnifiedMapWithHashingStrategy(HashingStrategy<? super K> hashingStrategy, Pair<K,V>... pairs)
public static <K,V> UnifiedMapWithHashingStrategy<K,V> newMap(HashingStrategy<? super K> hashingStrategy)
public static <K,V> UnifiedMapWithHashingStrategy<K,V> newMap(HashingStrategy<? super K> hashingStrategy, int size)
public static <K,V> UnifiedMapWithHashingStrategy<K,V> newMap(HashingStrategy<? super K> hashingStrategy, int size, float loadFactor)
public static <K,V> UnifiedMapWithHashingStrategy<K,V> newMap(HashingStrategy<? super K> hashingStrategy, Map<? extends K,? extends V> map)
public static <K,V> UnifiedMapWithHashingStrategy<K,V> newMapWith(HashingStrategy<? super K> hashingStrategy, Iterable<Pair<K,V>> inputIterable)
public static <K,V> UnifiedMapWithHashingStrategy<K,V> newMap(UnifiedMapWithHashingStrategy<K,V> map)
public static <K,V> UnifiedMapWithHashingStrategy<K,V> newMapWith(HashingStrategy<? super K> hashingStrategy, Pair<K,V>... pairs)
public static <K,V> UnifiedMapWithHashingStrategy<K,V> newWithKeysValues(HashingStrategy<? super K> hashingStrategy, K key, V value)
public static <K,V> UnifiedMapWithHashingStrategy<K,V> newWithKeysValues(HashingStrategy<? super K> hashingStrategy, K key1, V value1, K key2, V value2)
public static <K,V> UnifiedMapWithHashingStrategy<K,V> newWithKeysValues(HashingStrategy<? super K> hashingStrategy, K key1, V value1, K key2, V value2, K key3, V value3)
public static <K,V> UnifiedMapWithHashingStrategy<K,V> newWithKeysValues(HashingStrategy<? super K> hashingStrategy, K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4)
public UnifiedMapWithHashingStrategy<K,V> withKeysValues(K key, V value)
public UnifiedMapWithHashingStrategy<K,V> withKeysValues(K key1, V value1, K key2, V value2)
public UnifiedMapWithHashingStrategy<K,V> withKeysValues(K key1, V value1, K key2, V value2, K key3, V value3)
public UnifiedMapWithHashingStrategy<K,V> withKeysValues(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4)
public HashingStrategy<? super K> hashingStrategy()
public UnifiedMapWithHashingStrategy<K,V> clone()
clone in interface MutableMap<K,V>clone in class AbstractMutableMap<K,V>public MutableMap<K,V> newEmpty()
newEmpty in interface MutableMap<K,V>newEmpty in interface MutableMapIterable<K,V>public MutableMap<K,V> newEmpty(int capacity)
AbstractMutableMapnewEmpty in class AbstractMutableMap<K,V>public V updateValue(K key, Function0<? extends V> factory, Function<? super V,? extends V> function)
updateValue in interface MutableMapIterable<K,V>updateValue in class AbstractMutableMapIterable<K,V>public <P> V updateValueWith(K key, Function0<? extends V> factory, Function2<? super V,? super P,? extends V> function, P parameter)
updateValueWith in interface MutableMapIterable<K,V>updateValueWith in class AbstractMutableMapIterable<K,V>public V getIfAbsentPut(K key, Function0<? extends V> function)
getIfAbsentPut in interface MutableMapIterable<K,V>getIfAbsentPut in class AbstractMutableMapIterable<K,V>public V getIfAbsentPut(K key, V value)
getIfAbsentPut in interface MutableMapIterable<K,V>getIfAbsentPut in class AbstractMutableMapIterable<K,V>public <P> V getIfAbsentPutWith(K key, Function<? super P,? extends V> function, P parameter)
getIfAbsentPutWith in interface MutableMapIterable<K,V>getIfAbsentPutWith in class AbstractMutableMapIterable<K,V>public int getCollidingBuckets()
public int getMapMemoryUsedInWords()
public boolean containsKey(Object key)
containsKey in interface Map<K,V>containsKey in interface MapIterable<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>containsValue in interface MapIterable<K,V>public void forEachKeyValue(Procedure2<? super K,? super V> procedure)
forEachKeyValue in interface MapIterable<K,V>public V getFirst()
getFirst in interface RichIterable<V>getFirst in class AbstractMapIterable<K,V>public <E> MutableMap<K,V> collectKeysAndValues(Iterable<E> iterable, Function<? super E,? extends K> keyFunction, Function<? super E,? extends V> valueFunction)
collectKeysAndValues in interface MutableMap<K,V>public int getBatchCount(int batchSize)
getBatchCount in interface BatchIterable<V>public void batchForEach(Procedure<? super V> procedure, int sectionIndex, int sectionCount)
batchForEach in interface BatchIterable<V>public void forEachKey(Procedure<? super K> procedure)
forEachKey in interface MapIterable<K,V>forEachKey in class AbstractMapIterable<K,V>public void forEachValue(Procedure<? super V> procedure)
forEachValue in interface MapIterable<K,V>forEachValue in class AbstractMapIterable<K,V>public boolean isEmpty()
isEmpty in interface Map<K,V>isEmpty in interface RichIterable<V>isEmpty in class AbstractRichIterable<V>public int size()
size in interface Map<K,V>size in interface RichIterable<V>size in interface BatchIterable<V>public boolean equals(Object object)
public int hashCode()
public String toString()
AbstractRichIterable
Assert.assertEquals("[]", Lists.mutable.empty().toString());
Assert.assertEquals("[1]", Lists.mutable.with(1).toString());
Assert.assertEquals("[1, 2, 3]", Lists.mutable.with(1, 2, 3).toString());
toString in interface MapIterable<K,V>toString in interface RichIterable<V>toString in class AbstractRichIterable<V>AbstractCollection.toString()public boolean trimToSize()
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void forEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure)
forEachWithIndex in interface InternalIterable<V>forEachWithIndex in class AbstractMapIterable<K,V>public <P> void forEachWith(Procedure2<? super V,? super P> procedure, P parameter)
forEachWith in interface InternalIterable<V>forEachWith in class AbstractMapIterable<K,V>public <R> MutableMap<K,R> collectValues(Function2<? super K,? super V,? extends R> function)
collectValues in interface MapIterable<K,V>collectValues in interface MutableMap<K,V>collectValues in interface MutableMapIterable<K,V>collectValues in interface UnsortedMapIterable<K,V>collectValues in class AbstractMutableMap<K,V>public ImmutableMap<K,V> toImmutable()
toImmutable in interface MapIterable<K,V>toImmutable in interface MutableMapIterable<K,V>toImmutable in interface UnsortedMapIterable<K,V>toImmutable in class AbstractMutableMap<K,V>Copyright © 2004–2022. All rights reserved.