Top Fields Constructors Methods
org.eclipse.collections.impl.multimap.bag

public abstract Class AbstractMutableBagMultimap<K, V>

extends AbstractMutableMultimap<K, V, MutableBag<V>>
implements MutableBagMultimap<K, V>
Class Inheritance
All Implemented Interfaces
org.eclipse.collections.api.multimap.bag.MutableBagMultimap, org.eclipse.collections.api.multimap.bag.UnsortedBagMultimap, org.eclipse.collections.api.multimap.bag.BagMultimap, org.eclipse.collections.api.multimap.Multimap, org.eclipse.collections.api.multimap.bag.MutableBagIterableMultimap, org.eclipse.collections.api.multimap.MutableMultimap
Known Direct Subclasses
org.eclipse.collections.impl.multimap.bag.HashBagMultimap, org.eclipse.collections.impl.multimap.bag.MultiReaderHashBagMultimap, org.eclipse.collections.impl.multimap.bag.strategy.HashBagMultimapWithHashingStrategy
Imports
java.io.IOException, .ObjectInput, .ObjectOutput, org.eclipse.collections.api.bag.ImmutableBag, .MutableBag, org.eclipse.collections.api.block.function.Function, .Function2, org.eclipse.collections.api.block.procedure.Procedure2, org.eclipse.collections.api.map.MutableMap, org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap, .MutableBagMultimap, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.impl.block.procedure.checked.CheckedObjectIntProcedure, .CheckedProcedure2, org.eclipse.collections.impl.multimap.AbstractMutableMultimap

Field Summary

Inherited from org.eclipse.collections.impl.multimap.AbstractMutableMultimap:
maptotalSize

Constructor Summary

AccessConstructor and Description
protected
protected
protected
protected

Method Summary

Modifier and TypeMethod and Description
public MutableBagMultimap<K, V>
public <K2, V2> HashBagMultimap<K2, V2>
collectKeyMultiValues(Function<? super K, ? extends K2> keyFunction, Function<? super V, ? extends V2> valueFunction)

Implements org.eclipse.collections.api.multimap.bag.MutableBagMultimap.collectKeyMultiValues, org.eclipse.collections.api.multimap.MutableMultimap.collectKeyMultiValues, org.eclipse.collections.api.multimap.Multimap.collectKeyMultiValues.

Returns a new multimap with the results of applying the specified keyFunction and valueFunction on each key and corresponding values of the source multimap.

public <K2, V2> HashBagMultimap<K2, V2>
collectKeysValues(Function2<? super K, ? super V, Pair<K2, V2>> function)

Implements org.eclipse.collections.api.multimap.bag.MutableBagMultimap.collectKeysValues, org.eclipse.collections.api.multimap.MutableMultimap.collectKeysValues, org.eclipse.collections.api.multimap.Multimap.collectKeysValues.

Returns a new multimap with the results of applying the specified function on each key and value of the source multimap.

public void
public void
public void
public ImmutableBagMultimap<K, V>
public MutableBagMultimap<K, V>
public void
Inherited from org.eclipse.collections.impl.multimap.AbstractMutableMultimap:
addToTotalSizeclearclearTotalSizecreateMapcreateMapWithKeyCountdecrementTotalSizegetgetIfAbsentPutAllgetMapincrementTotalSizeisEmptykeySetputputAllputAllremoveremoveAllreplaceValuessizesizeDistinctsubtractFromTotalSizetoMaptoMap

Constructor Detail

AbstractMutableBagMultimapback to summary
protected AbstractMutableBagMultimap()
AbstractMutableBagMultimapback to summary
protected AbstractMutableBagMultimap(Pair<K, V>... pairs)
AbstractMutableBagMultimapback to summary
protected AbstractMutableBagMultimap(Iterable<Pair<K, V>> inputIterable)
AbstractMutableBagMultimapback to summary
protected AbstractMutableBagMultimap(int size)

Method Detail

asSynchronizedback to summary
public MutableBagMultimap<K, V> asSynchronized()

Implements org.eclipse.collections.api.multimap.bag.MutableBagMultimap.asSynchronized, org.eclipse.collections.api.multimap.MutableMultimap.asSynchronized.

Doc from org.eclipse.collections.api.multimap.MutableMultimap.asSynchronized.

Returns a synchronized wrapper backed by this multimap. The preferred way of iterating over a synchronized multimap is to use the forEachKey(), forEachValue(), forEachKeyValue() and forEachKeyMultiValues methods which are properly synchronized internally.

 MutableMultimap synchedMultimap = multimap.asSynchronized();

 synchedMultimap.forEachKey(key -> ... );
 synchedMultimap.forEachValue(value -> ... );
 synchedMultimap.forEachKeyValue((key, value) -> ... );
 synchedMultimap.forEachKeyMultiValues((key, values) -> ... );

If you want to iterate imperatively over the keySet(), keysView(), valuesView(), or other views, you will need to protect the iteration by wrapping the code in a synchronized block on the multimap.

Annotations
@Override
collectKeyMultiValuesback to summary
public <K2, V2> HashBagMultimap<K2, V2> collectKeyMultiValues(Function<? super K, ? extends K2> keyFunction, Function<? super V, ? extends V2> valueFunction)

Implements org.eclipse.collections.api.multimap.bag.MutableBagMultimap.collectKeyMultiValues, org.eclipse.collections.api.multimap.MutableMultimap.collectKeyMultiValues, org.eclipse.collections.api.multimap.Multimap.collectKeyMultiValues.

Doc from org.eclipse.collections.api.multimap.Multimap.collectKeyMultiValues.

Returns a new multimap with the results of applying the specified keyFunction and valueFunction on each key and corresponding values of the source multimap. This method is also commonly called transform or map.

e.g.
return multimap.collectKeyMultiValues(each -> each + 1, Person::getLastName);
Annotations
@Override
collectKeysValuesback to summary
public <K2, V2> HashBagMultimap<K2, V2> collectKeysValues(Function2<? super K, ? super V, Pair<K2, V2>> function)

Implements org.eclipse.collections.api.multimap.bag.MutableBagMultimap.collectKeysValues, org.eclipse.collections.api.multimap.MutableMultimap.collectKeysValues, org.eclipse.collections.api.multimap.Multimap.collectKeysValues.

Doc from org.eclipse.collections.api.multimap.Multimap.collectKeysValues.

Returns a new multimap with the results of applying the specified function on each key and value of the source multimap. This method is also commonly called transform or map.

e.g.
return multimap.collectKeysValues(new Function2<Integer, Person, Pair<String, String>>()
{
    public Pair<String, String> valueOf(Integer age, Person person)
    {
        return Tuples.pair(age.toString(), person.getLastName());
    }
});
Annotations
@Override
forEachKeyMutableBagback to summary
public void forEachKeyMutableBag(Procedure2<? super K, ? super MutableBag<V>> procedure)

Implements org.eclipse.collections.api.multimap.bag.MutableBagMultimap.forEachKeyMutableBag.

Annotations
@Override
putOccurrencesback to summary
public void putOccurrences(K key, V value, int occurrences)

Implements org.eclipse.collections.api.multimap.bag.MutableBagMultimap.putOccurrences.

Annotations
@Override
readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Overrides org.eclipse.collections.impl.multimap.AbstractMutableMultimap.readExternal.

Annotations
@Override
toImmutableback to summary
public ImmutableBagMultimap<K, V> toImmutable()

Implements org.eclipse.collections.api.multimap.Multimap.toImmutable, org.eclipse.collections.api.multimap.bag.UnsortedBagMultimap.toImmutable.

Doc from org.eclipse.collections.api.multimap.Multimap.toImmutable.

Returns an immutable copy of this Multimap if it is not already immutable. If the Multimap is immutable, it will return itself.

The returned Multimap will be Serializable if this Multimap is Serializable.

Annotations
@Override
toMutableback to summary
public MutableBagMultimap<K, V> toMutable()

Implements org.eclipse.collections.api.multimap.Multimap.toMutable, org.eclipse.collections.api.multimap.bag.UnsortedBagMultimap.toMutable.

Doc from org.eclipse.collections.api.multimap.Multimap.toMutable.

Returns a mutable copy of this Multimap.

Annotations
@Override
writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Overrides org.eclipse.collections.impl.multimap.AbstractMutableMultimap.writeExternal.

Annotations
@Override