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

public abstract Class AbstractMutableMultimap<K, V, C extends MutableCollection<V>>

extends AbstractMultimap<K, V, C extends MutableCollection<V>>
implements MutableMultimap<K, V>
Class Inheritance
All Implemented Interfaces
org.eclipse.collections.api.multimap.MutableMultimap, org.eclipse.collections.api.multimap.Multimap
Known Direct Subclasses
org.eclipse.collections.impl.multimap.AbstractSynchronizedPutMultimap, org.eclipse.collections.impl.multimap.bag.AbstractMutableBagMultimap, org.eclipse.collections.impl.multimap.bag.TreeBagMultimap, org.eclipse.collections.impl.multimap.bag.sorted.TreeBagMultimap, org.eclipse.collections.impl.multimap.bag.sorted.mutable.TreeBagMultimap, org.eclipse.collections.impl.multimap.list.AbstractMutableListMultimap, org.eclipse.collections.impl.multimap.set.AbstractMutableSetMultimap, org.eclipse.collections.impl.multimap.set.sorted.TreeSortedSetMultimap
Imports
java.io.IOException, .ObjectInput, .ObjectOutput, java.util.Collection, org.eclipse.collections.api.RichIterable, org.eclipse.collections.api.block.function.Function0, org.eclipse.collections.api.block.procedure.Procedure, .Procedure2, org.eclipse.collections.api.collection.MutableCollection, org.eclipse.collections.api.map.MutableMap, org.eclipse.collections.api.multimap.Multimap, .MutableMultimap, org.eclipse.collections.api.set.SetIterable, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.impl.block.procedure.checked.MultimapKeyValuesSerializingProcedure, org.eclipse.collections.impl.set.mutable.UnmodifiableMutableSet, org.eclipse.collections.impl.utility.Iterate

Field Summary

Modifier and TypeField and Description
protected MutableMap<K, C>
protected int

Constructor Summary

AccessConstructor and Description
protected
protected
protected
protected
AbstractMutableMultimap(Pair<K, V>...
the mappings to initialize the multimap.
pairs
)

Constructs a Multimap containing all the Pairs.

protected
AbstractMutableMultimap(Iterable<Pair<K, V>>
the mappings to initialize the multimap.
inputIterable
)

Constructs a Multimap containing Iterable.

Method Summary

Modifier and TypeMethod and Description
protected void
addToTotalSize(int value)

This method is provided to allow for subclasses to provide the behavior.

public void
protected void
clearTotalSize()

This method is provided to allow for subclasses to provide the behavior.

protected abstract MutableMap<K, C>
protected abstract MutableMap<K, C>
createMapWithKeyCount(int keyCount)

protected void
decrementTotalSize()

This method is provided to allow for subclasses to provide the behavior.

public C
get(K key)

Implements org.eclipse.collections.api.multimap.MutableMultimap.get, org.eclipse.collections.api.multimap.Multimap.get.

Returns a view of all values associated with the given key.

public C
getIfAbsentPutAll(K key, Iterable<? extends V> values)

Implements org.eclipse.collections.api.multimap.MutableMultimap.getIfAbsentPutAll.

Puts values into multimap if there are no values already associated with key.

private C
protected MutableMap<K, C>
protected void
incrementTotalSize()

This method is provided to allow for subclasses to provide the behavior.

public boolean
isEmpty()

Implements org.eclipse.collections.api.multimap.Multimap.isEmpty.

Returns true if there are no entries.

public SetIterable<K>
keySet()

Implements org.eclipse.collections.api.multimap.Multimap.keySet.

Returns an unmodifiable SetIterable of keys with O(1) complexity.

public boolean
public boolean
public <KK extends K, VV extends V> boolean
private <KK extends K, VV extends V> boolean
private boolean
putAllNotEmpty(K key, Iterable<? extends V> values)

private <KK extends K, VV extends V> boolean
putAllReadOnlyMultimap(Multimap<KK, VV> multimap)

public void
pack-priv void
public boolean
public C
public C
public int
size()

Implements org.eclipse.collections.api.multimap.Multimap.size.

Use the size method directly instead of totalSize internally so subclasses can override if necessary.

public int
sizeDistinct()

Implements org.eclipse.collections.api.multimap.Multimap.sizeDistinct.

Returns the number of distinct keys.

protected void
subtractFromTotalSize(int value)

This method is provided to allow for subclasses to provide the behavior.

public MutableMap<K, RichIterable<V>>
toMap()

Implements org.eclipse.collections.api.multimap.Multimap.toMap.

Returns a new MutableMap of keys from this Multimap to the mapped values as a RichIterable.

public <R extends Collection<V>> MutableMap<K, R>
toMap(Function0<R> collectionFactory)

Implements org.eclipse.collections.api.multimap.Multimap.toMap.

Returns a new MutableMap of keys from this Multimap to the mapped values as a RichIterable.

public void
Inherited from org.eclipse.collections.impl.multimap.AbstractMultimap:
collectKeyMultiValuescollectKeysValuescollectValuescontainsKeycontainsKeyAndValuecontainsValuecreateCollectioncreateCollectionBlockequalsforEachKeyforEachKeyMultiValuesforEachKeyValueforEachValuehashCodekeyBagkeyMultiValuePairsViewkeysViewkeyValuePairsViewmultiValuesViewnotEmptyrejectKeysMultiValuesrejectKeysValuesselectKeysMultiValuesselectKeysValuestoStringvaluesView

Field Detail

mapback to summary
protected MutableMap<K, C> map
totalSizeback to summary
protected int totalSize

Constructor Detail

AbstractMutableMultimapback to summary
protected AbstractMutableMultimap()
AbstractMutableMultimapback to summary
protected AbstractMutableMultimap(MutableMap<K, C> newMap)
AbstractMutableMultimapback to summary
protected AbstractMutableMultimap(int size)
AbstractMutableMultimapback to summary
protected AbstractMutableMultimap(Pair<K, V>... pairs)

Constructs a Multimap containing all the Pairs.

Parameters
pairs:Pair<K, V>[]

the mappings to initialize the multimap.

AbstractMutableMultimapback to summary
protected AbstractMutableMultimap(Iterable<Pair<K, V>> inputIterable)

Constructs a Multimap containing Iterable.

Parameters
inputIterable:Iterable<Pair<K, V>>

the mappings to initialize the multimap.

Method Detail

addToTotalSizeback to summary
protected void addToTotalSize(int value)

This method is provided to allow for subclasses to provide the behavior. It should add the specified amount to the value that is returned by calling size().

clearback to summary
public void clear()

Implements org.eclipse.collections.api.multimap.MutableMultimap.clear.

Annotations
@Override
clearTotalSizeback to summary
protected void clearTotalSize()

This method is provided to allow for subclasses to provide the behavior. It should set the value returned by size() to 0.

createMapback to summary
protected abstract MutableMap<K, C> createMap()
createMapWithKeyCountback to summary
protected abstract MutableMap<K, C> createMapWithKeyCount(int keyCount)
decrementTotalSizeback to summary
protected void decrementTotalSize()

This method is provided to allow for subclasses to provide the behavior. It should remove 1 from the value that is returned by calling size().

getback to summary
public C get(K key)

Implements org.eclipse.collections.api.multimap.MutableMultimap.get, org.eclipse.collections.api.multimap.Multimap.get.

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

Returns a view of all values associated with the given key.

If the given key does not exist, an empty RichIterable is returned.

Annotations
@Override
getIfAbsentPutAllback to summary
public C getIfAbsentPutAll(K key, Iterable<? extends V> values)

Implements org.eclipse.collections.api.multimap.MutableMultimap.getIfAbsentPutAll.

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

Puts values into multimap if there are no values already associated with key. Then returns a view of the values associated with key, like the result of Multimap#get(Object)

Annotations
@Override
getIfAbsentPutCollectionback to summary
private C getIfAbsentPutCollection(K key)
getMapback to summary
protected MutableMap<K, C> getMap()

Implements abstract org.eclipse.collections.impl.multimap.AbstractMultimap.getMap.

Annotations
@Override
incrementTotalSizeback to summary
protected void incrementTotalSize()

This method is provided to allow for subclasses to provide the behavior. It should add 1 to the value that is returned by calling size().

isEmptyback to summary
public boolean isEmpty()

Implements org.eclipse.collections.api.multimap.Multimap.isEmpty.

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

Returns true if there are no entries.

Annotations
@Override
keySetback to summary
public SetIterable<K> keySet()

Implements org.eclipse.collections.api.multimap.Multimap.keySet.

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

Returns an unmodifiable SetIterable of keys with O(1) complexity.

Annotations
@Override
putback to summary
public boolean put(K key, V value)

Implements org.eclipse.collections.api.multimap.MutableMultimap.put.

Annotations
@Override
putAllback to summary
public boolean putAll(K key, Iterable<? extends V> values)

Implements org.eclipse.collections.api.multimap.MutableMultimap.putAll.

Annotations
@Override
putAllback to summary
public <KK extends K, VV extends V> boolean putAll(Multimap<KK, VV> multimap)

Implements org.eclipse.collections.api.multimap.MutableMultimap.putAll.

Annotations
@Override
putAllAbstractMutableMultimapback to summary
private <KK extends K, VV extends V> boolean putAllAbstractMutableMultimap(AbstractMutableMultimap<KK, VV, MutableCollection<VV>> other)
putAllNotEmptyback to summary
private boolean putAllNotEmpty(K key, Iterable<? extends V> values)
putAllReadOnlyMultimapback to summary
private <KK extends K, VV extends V> boolean putAllReadOnlyMultimap(Multimap<KK, VV> multimap)
readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readValuesFromback to summary
pack-priv void readValuesFrom(ObjectInput in) throws IOException, ClassNotFoundException
removeback to summary
public boolean remove(Object key, Object value)

Implements org.eclipse.collections.api.multimap.MutableMultimap.remove.

Annotations
@Override
removeAllback to summary
public C removeAll(Object key)

Implements org.eclipse.collections.api.multimap.MutableMultimap.removeAll.

Annotations
@Override
replaceValuesback to summary
public C replaceValues(K key, Iterable<? extends V> values)

Implements org.eclipse.collections.api.multimap.MutableMultimap.replaceValues.

Annotations
@Override
sizeback to summary
public int size()

Implements org.eclipse.collections.api.multimap.Multimap.size.

Use the size method directly instead of totalSize internally so subclasses can override if necessary.

Annotations
@Override
sizeDistinctback to summary
public int sizeDistinct()

Implements org.eclipse.collections.api.multimap.Multimap.sizeDistinct.

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

Returns the number of distinct keys.

Annotations
@Override
subtractFromTotalSizeback to summary
protected void subtractFromTotalSize(int value)

This method is provided to allow for subclasses to provide the behavior. It should subtract the specified amount from the value that is returned by calling size().

toMapback to summary
public MutableMap<K, RichIterable<V>> toMap()

Implements org.eclipse.collections.api.multimap.Multimap.toMap.

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

Returns a new MutableMap of keys from this Multimap to the mapped values as a RichIterable.

Annotations
@Override
toMapback to summary
public <R extends Collection<V>> MutableMap<K, R> toMap(Function0<R> collectionFactory)

Implements org.eclipse.collections.api.multimap.Multimap.toMap.

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

Returns a new MutableMap of keys from this Multimap to the mapped values as a RichIterable.

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