Class AbstractSynchronizedPutMultimap<K,V,C extends MutableCollection<V>>
- java.lang.Object
-
- org.eclipse.collections.impl.multimap.AbstractMultimap<K,V,C>
-
- org.eclipse.collections.impl.multimap.AbstractMutableMultimap<K,V,C>
-
- org.eclipse.collections.impl.multimap.AbstractSynchronizedPutMultimap<K,V,C>
-
- All Implemented Interfaces:
Multimap<K,V>
,MutableMultimap<K,V>
- Direct Known Subclasses:
SynchronizedPutFastListMultimap
,SynchronizedPutHashBagMultimap
,SynchronizedPutTreeSortedSetMultimap
,SynchronizedPutUnifiedSetMultimap
public abstract class AbstractSynchronizedPutMultimap<K,V,C extends MutableCollection<V>> extends AbstractMutableMultimap<K,V,C>
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicInteger
atomicTotalSize
-
Fields inherited from class org.eclipse.collections.impl.multimap.AbstractMutableMultimap
map, totalSize
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSynchronizedPutMultimap()
protected
AbstractSynchronizedPutMultimap(MutableMap<K,C> newMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addAll(C existingValues, V[] values)
protected void
addToTotalSize(int value)
This method is provided to allow for subclasses to provide the behavior.protected void
clearTotalSize()
This method is provided to allow for subclasses to provide the behavior.protected MutableMap<K,C>
createMap()
protected MutableMap<K,C>
createMapWithKeyCount(int keyCount)
protected void
decrementTotalSize()
This method is provided to allow for subclasses to provide the behavior.C
getIfAbsentPutAll(K key, java.lang.Iterable<? extends V> values)
Puts values into multimap if there are no values already associated with key.private C
getIfAbsentPutCollection(K key)
protected void
incrementTotalSize()
This method is provided to allow for subclasses to provide the behavior.boolean
put(K key, V value)
int
size()
Use the size method directly instead of totalSize internally so subclasses can override if necessary.protected void
subtractFromTotalSize(int value)
This method is provided to allow for subclasses to provide the behavior.MutableMultimap<K,V>
withKeyMultiValues(K key, V... values)
Puts the key / values combination into the MutableMultimap and returns the MutableMultimap (this).-
Methods inherited from class org.eclipse.collections.impl.multimap.AbstractMutableMultimap
clear, get, getMap, isEmpty, keySet, putAll, putAll, readExternal, readValuesFrom, remove, removeAll, replaceValues, sizeDistinct, toMap, toMap, writeExternal
-
Methods inherited from class org.eclipse.collections.impl.multimap.AbstractMultimap
collectKeyMultiValues, collectKeysValues, collectValues, containsKey, containsKeyAndValue, containsValue, createCollection, createCollectionBlock, equals, forEachKey, forEachKeyMultiValues, forEachKeyValue, forEachValue, hashCode, keyBag, keyMultiValuePairsView, keysView, keyValuePairsView, multiValuesView, notEmpty, rejectKeysMultiValues, rejectKeysValues, selectKeysMultiValues, selectKeysValues, toString, valuesView
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.api.multimap.Multimap
collectKeyMultiValues, collectKeysValues, collectValues, containsKey, containsKeyAndValue, containsValue, equals, forEachKey, forEachKeyMultiValues, forEachKeyValue, forEachValue, hashCode, keyBag, keyMultiValuePairsView, keysView, keyValuePairsView, multiValuesView, notEmpty, rejectKeysMultiValues, rejectKeysValues, selectKeysMultiValues, selectKeysValues, toImmutable, toMutable, valuesView
-
Methods inherited from interface org.eclipse.collections.api.multimap.MutableMultimap
add, asSynchronized, collectKeyMultiValues, collectKeysValues, collectValues, flip, newEmpty, putAllPairs, putAllPairs, rejectKeysMultiValues, rejectKeysValues, selectKeysMultiValues, selectKeysValues, withKeyValue
-
-
-
-
Constructor Detail
-
AbstractSynchronizedPutMultimap
protected AbstractSynchronizedPutMultimap()
-
AbstractSynchronizedPutMultimap
protected AbstractSynchronizedPutMultimap(MutableMap<K,C> newMap)
-
-
Method Detail
-
createMap
protected MutableMap<K,C> createMap()
- Specified by:
createMap
in classAbstractMutableMultimap<K,V,C extends MutableCollection<V>>
-
createMapWithKeyCount
protected MutableMap<K,C> createMapWithKeyCount(int keyCount)
- Specified by:
createMapWithKeyCount
in classAbstractMutableMultimap<K,V,C extends MutableCollection<V>>
-
size
public int size()
Description copied from class:AbstractMutableMultimap
Use the size method directly instead of totalSize internally so subclasses can override if necessary.
-
incrementTotalSize
protected void incrementTotalSize()
Description copied from class:AbstractMutableMultimap
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().- Overrides:
incrementTotalSize
in classAbstractMutableMultimap<K,V,C extends MutableCollection<V>>
-
decrementTotalSize
protected void decrementTotalSize()
Description copied from class:AbstractMutableMultimap
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().- Overrides:
decrementTotalSize
in classAbstractMutableMultimap<K,V,C extends MutableCollection<V>>
-
addToTotalSize
protected void addToTotalSize(int value)
Description copied from class:AbstractMutableMultimap
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().- Overrides:
addToTotalSize
in classAbstractMutableMultimap<K,V,C extends MutableCollection<V>>
-
subtractFromTotalSize
protected void subtractFromTotalSize(int value)
Description copied from class:AbstractMutableMultimap
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().- Overrides:
subtractFromTotalSize
in classAbstractMutableMultimap<K,V,C extends MutableCollection<V>>
-
clearTotalSize
protected void clearTotalSize()
Description copied from class:AbstractMutableMultimap
This method is provided to allow for subclasses to provide the behavior. It should set the value returned by size() to 0.- Overrides:
clearTotalSize
in classAbstractMutableMultimap<K,V,C extends MutableCollection<V>>
-
put
public boolean put(K key, V value)
- Specified by:
put
in interfaceMutableMultimap<K,V>
- Overrides:
put
in classAbstractMutableMultimap<K,V,C extends MutableCollection<V>>
-
withKeyMultiValues
public MutableMultimap<K,V> withKeyMultiValues(K key, V... values)
Description copied from interface:MutableMultimap
Puts the key / values combination into the MutableMultimap and returns the MutableMultimap (this).
-
getIfAbsentPutAll
public C getIfAbsentPutAll(K key, java.lang.Iterable<? extends V> values)
Description copied from interface:MutableMultimap
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 ofMultimap.get(Object)
- Specified by:
getIfAbsentPutAll
in interfaceMutableMultimap<K,V>
- Overrides:
getIfAbsentPutAll
in classAbstractMutableMultimap<K,V,C extends MutableCollection<V>>
-
-