Class ImmutableUnifiedMapWithHashingStrategy<K,V>
java.lang.Object
org.eclipse.collections.impl.AbstractRichIterable<V>
org.eclipse.collections.impl.map.AbstractMapIterable<K,V>
org.eclipse.collections.impl.map.immutable.AbstractImmutableMap<K,V>
org.eclipse.collections.impl.map.strategy.immutable.ImmutableUnifiedMapWithHashingStrategy<K,V>
- All Implemented Interfaces:
Serializable,Iterable<V>,Map<K,V>,InternalIterable<V>,ImmutableMap<K,V>,ImmutableMapIterable<K,V>,MapIterable<K,V>,UnsortedMapIterable<K,V>,RichIterable<V>,BatchIterable<V>
public class ImmutableUnifiedMapWithHashingStrategy<K,V> extends AbstractImmutableMap<K,V> implements BatchIterable<V>, Serializable
- See Also:
ImmutableMap, Serialized Form
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description ImmutableUnifiedMapWithHashingStrategy(HashingStrategy<? super K> hashingStrategy, Pair<K,V>... pairs)ImmutableUnifiedMapWithHashingStrategy(UnifiedMapWithHashingStrategy<K,V> delegate) -
Method Summary
Modifier and Type Method Description voidbatchForEach(Procedure<? super V> procedure, int sectionIndex, int sectionCount)<R> ImmutableMap<K,R>collectValues(Function2<? super K,? super V,? extends R> function)For each key and value of the map the function is evaluated.booleancontainsKey(Object key)booleancontainsValue(Object value)Set<Map.Entry<K,V>>entrySet()booleanequals(Object o)Follows the same general contract asMap.equals(Object).voidforEachKey(Procedure<? super K> procedure)Calls theprocedurewith each key of the map.voidforEachKeyValue(Procedure2<? super K,? super V> procedure)Calls theprocedurewith each key-value pair of the map.voidforEachValue(Procedure<? super V> procedure)Calls the procedure with each value of the map.<P> voidforEachWith(Procedure2<? super V,? super P> procedure, P parameter)The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.voidforEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure)Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.Vget(Object key)intgetBatchCount(int batchSize)inthashCode()Follows the same general contract asMap.hashCode().Set<K>keySet()RichIterable<K>keysView()Returns an unmodifiable lazy iterable wrapped around the keySet for the map.RichIterable<Pair<K,V>>keyValuesView()Returns an unmodifiable lazy iterable of key/value pairs wrapped around the entrySet for the map.ImmutableMap<K,V>newWithAllKeyValueArguments(Pair<? extends K,? extends V>... keyValuePairs)ImmutableMap<K,V>newWithAllKeyValues(Iterable<? extends Pair<? extends K,? extends V>> keyValues)ImmutableMap<K,V>newWithKeyValue(K key, V value)ImmutableMap<K,V>newWithoutAllKeys(Iterable<? extends K> keys)ImmutableMap<K,V>newWithoutKey(K key)ImmutableMap<K,V>reject(Predicate2<? super K,? super V> predicate)For each key and value of the map the predicate is evaluated, if the result of the evaluation is false, that key and value are returned in a new map.ImmutableMap<K,V>select(Predicate2<? super K,? super V> predicate)For each key and value of the map the predicate is evaluated, if the result of the evaluation is true, that key and value are returned in a new map.intsize()Returns the number of items in this iterable.StringtoString()Returns a string with the elements of the iterable separated by commas with spaces and enclosed in square brackets.Collection<V>values()RichIterable<V>valuesView()Returns an unmodifiable lazy iterable wrapped around the values for the map.Methods inherited from class org.eclipse.collections.impl.map.immutable.AbstractImmutableMap
aggregateBy, aggregateInPlaceBy, castToMap, clear, collect, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, countBy, countByEach, countByWith, detect, detectOptional, flatCollect, flip, flipUniqueValues, groupBy, groupByEach, groupByUniqueKey, iterator, partition, partitionWith, put, putAll, reject, rejectWith, remove, select, selectInstancesOf, selectWith, sumByDouble, sumByFloat, sumByInt, sumByLong, tap, toImmutable, toMap, zip, zipWithIndexMethods inherited from class org.eclipse.collections.impl.map.AbstractMapIterable
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, asLazy, chunk, contains, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, getFirst, getIfAbsent, getIfAbsentValue, getIfAbsentWith, getLast, getOnly, getOrDefault, ifPresentApply, noneSatisfy, noneSatisfyWith, toArray, toArrayMethods inherited from class org.eclipse.collections.impl.AbstractRichIterable
appendString, appendString, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, containsAll, containsAllArguments, containsAllIterable, count, countWith, flatCollect, forEach, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, 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, zipWithIndexMethods inherited from interface org.eclipse.collections.api.map.ImmutableMap
aggregateBy, flatCollectWithMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, isEmpty, merge, putIfAbsent, remove, replace, replace, replaceAllMethods inherited from interface org.eclipse.collections.api.map.MapIterable
getIfAbsent, getIfAbsentValue, getIfAbsentWith, getOrDefault, ifPresentApply, parallelStream, spliterator, streamMethods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, containsBy, count, countBy, countByEach, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, getFirst, getLast, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, 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, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndex
-
Constructor Details
-
ImmutableUnifiedMapWithHashingStrategy
-
ImmutableUnifiedMapWithHashingStrategy
public ImmutableUnifiedMapWithHashingStrategy(HashingStrategy<? super K> hashingStrategy, Pair<K,V>... pairs)
-
-
Method Details
-
equals
Description copied from interface:MapIterableFollows the same general contract asMap.equals(Object). -
hashCode
public int hashCode()Description copied from interface:MapIterableFollows the same general contract asMap.hashCode(). -
toString
Description copied from class:AbstractRichIterableReturns a string with the elements of the iterable separated by commas with spaces and enclosed in square brackets.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());- Specified by:
toStringin interfaceMapIterable<K,V>- Specified by:
toStringin interfaceRichIterable<K>- Overrides:
toStringin classAbstractRichIterable<V>- Returns:
- a string representation of this collection.
- See Also:
AbstractCollection.toString()
-
size
public int size()Description copied from interface:RichIterableReturns the number of items in this iterable.- Specified by:
sizein interfaceBatchIterable<K>- Specified by:
sizein interfaceMap<K,V>- Specified by:
sizein interfaceRichIterable<K>
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>- Specified by:
containsKeyin interfaceMapIterable<K,V>- See Also:
Map.containsKey(Object)
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>- Specified by:
containsValuein interfaceMapIterable<K,V>- See Also:
Map.containsValue(Object)
-
get
- Specified by:
getin interfaceMap<K,V>- Specified by:
getin interfaceMapIterable<K,V>- See Also:
Map.get(Object)
-
getBatchCount
public int getBatchCount(int batchSize)- Specified by:
getBatchCountin interfaceBatchIterable<K>
-
batchForEach
- Specified by:
batchForEachin interfaceBatchIterable<K>
-
forEachValue
Description copied from interface:MapIterableCalls the procedure with each value of the map.Set<String> result = UnifiedSet.newSet(); MutableMap<Integer, String> map = this.newMapWithKeysValues(1, "One", 2, "Two", 3, "Three", 4, "Four"); map.forEachValue(new CollectionAddProcedure<String>(result)); Verify.assertSetsEqual(UnifiedSet.newSetWith("One", "Two", "Three", "Four"), result);- Specified by:
forEachValuein interfaceMapIterable<K,V>- Overrides:
forEachValuein classAbstractMapIterable<K,V>
-
forEachKey
Description copied from interface:MapIterableCalls theprocedurewith each key of the map.final Collection<Integer> result = new ArrayList<Integer>(); MutableMap<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2", 3, "3"); map.forEachKey(new CollectionAddProcedure<Integer>(result)); Verify.assertContainsAll(result, 1, 2, 3);- Specified by:
forEachKeyin interfaceMapIterable<K,V>- Overrides:
forEachKeyin classAbstractMapIterable<K,V>
-
forEachKeyValue
Description copied from interface:MapIterableCalls theprocedurewith each key-value pair of the map.final Collection<String> collection = new ArrayList<String>(); MutableMap<Integer, String> map = this.newMapWithKeysValues(1, "One", 2, "Two", 3, "Three"); map.forEachKeyValue((Integer key, String value) -> collection.add(String.valueOf(key) + value)); Verify.assertContainsAll(collection, "1One", "2Two", "3Three");- Specified by:
forEachKeyValuein interfaceMapIterable<K,V>
-
entrySet
-
keySet
-
values
-
keysView
Description copied from interface:MapIterableReturns an unmodifiable lazy iterable wrapped around the keySet for the map.- Specified by:
keysViewin interfaceMapIterable<K,V>
-
valuesView
Description copied from interface:MapIterableReturns an unmodifiable lazy iterable wrapped around the values for the map.- Specified by:
valuesViewin interfaceMapIterable<K,V>
-
keyValuesView
Description copied from interface:MapIterableReturns an unmodifiable lazy iterable of key/value pairs wrapped around the entrySet for the map.- Specified by:
keyValuesViewin interfaceMapIterable<K,V>
-
forEachWithIndex
Description copied from interface:InternalIterableIterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.Example using a Java 8 lambda:
people.forEachWithIndex((Person person, int index) -> LOGGER.info("Index: " + index + " person: " + person.getName()));Example using an anonymous inner class:
people.forEachWithIndex(new ObjectIntProcedure<Person>() { public void value(Person person, int index) { LOGGER.info("Index: " + index + " person: " + person.getName()); } });- Specified by:
forEachWithIndexin interfaceInternalIterable<K>- Overrides:
forEachWithIndexin classAbstractMapIterable<K,V>
-
forEachWith
Description copied from interface:InternalIterableThe procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.Example using a Java 8 lambda:
people.forEachWith((Person person, Person other) -> { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } }, fred);Example using an anonymous inner class:
people.forEachWith(new Procedure2<Person, Person>() { public void value(Person person, Person other) { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } } }, fred);- Specified by:
forEachWithin interfaceInternalIterable<K>- Overrides:
forEachWithin classAbstractMapIterable<K,V>
-
newWithKeyValue
- Specified by:
newWithKeyValuein interfaceImmutableMap<K,V>- Specified by:
newWithKeyValuein interfaceImmutableMapIterable<K,V>- Overrides:
newWithKeyValuein classAbstractImmutableMap<K,V>
-
newWithAllKeyValues
public ImmutableMap<K,V> newWithAllKeyValues(Iterable<? extends Pair<? extends K,? extends V>> keyValues)- Specified by:
newWithAllKeyValuesin interfaceImmutableMap<K,V>- Specified by:
newWithAllKeyValuesin interfaceImmutableMapIterable<K,V>- Overrides:
newWithAllKeyValuesin classAbstractImmutableMap<K,V>
-
newWithAllKeyValueArguments
public ImmutableMap<K,V> newWithAllKeyValueArguments(Pair<? extends K,? extends V>... keyValuePairs)- Specified by:
newWithAllKeyValueArgumentsin interfaceImmutableMap<K,V>- Specified by:
newWithAllKeyValueArgumentsin interfaceImmutableMapIterable<K,V>- Overrides:
newWithAllKeyValueArgumentsin classAbstractImmutableMap<K,V>
-
newWithoutKey
- Specified by:
newWithoutKeyin interfaceImmutableMap<K,V>- Specified by:
newWithoutKeyin interfaceImmutableMapIterable<K,V>- Overrides:
newWithoutKeyin classAbstractImmutableMap<K,V>
-
newWithoutAllKeys
- Specified by:
newWithoutAllKeysin interfaceImmutableMap<K,V>- Specified by:
newWithoutAllKeysin interfaceImmutableMapIterable<K,V>- Overrides:
newWithoutAllKeysin classAbstractImmutableMap<K,V>
-
collectValues
Description copied from interface:MapIterableFor each key and value of the map the function is evaluated. The results of these evaluations are returned in a new map. The map returned will use the values projected from the function rather than the original values.MapIterable<City, String> collected = peopleByCity.collectValues((City city, Person person) -> person.getFirstName() + " " + person.getLastName());- Specified by:
collectValuesin interfaceImmutableMap<K,V>- Specified by:
collectValuesin interfaceImmutableMapIterable<K,V>- Specified by:
collectValuesin interfaceMapIterable<K,V>- Specified by:
collectValuesin interfaceUnsortedMapIterable<K,V>- Overrides:
collectValuesin classAbstractImmutableMap<K,V>
-
select
Description copied from interface:MapIterableFor each key and value of the map the predicate is evaluated, if the result of the evaluation is true, that key and value are returned in a new map.MapIterable<City, Person> selected = peopleByCity.select((city, person) -> city.getName().equals("Anytown") && person.getLastName().equals("Smith"));- Specified by:
selectin interfaceImmutableMap<K,V>- Specified by:
selectin interfaceImmutableMapIterable<K,V>- Specified by:
selectin interfaceMapIterable<K,V>- Specified by:
selectin interfaceUnsortedMapIterable<K,V>- Overrides:
selectin classAbstractImmutableMap<K,V>
-
reject
Description copied from interface:MapIterableFor each key and value of the map the predicate is evaluated, if the result of the evaluation is false, that key and value are returned in a new map.MapIterable<City, Person> rejected = peopleByCity.reject((city, person) -> city.getName().equals("Anytown") && person.getLastName().equals("Smith"));- Specified by:
rejectin interfaceImmutableMap<K,V>- Specified by:
rejectin interfaceImmutableMapIterable<K,V>- Specified by:
rejectin interfaceMapIterable<K,V>- Specified by:
rejectin interfaceUnsortedMapIterable<K,V>- Overrides:
rejectin classAbstractImmutableMap<K,V>
-