Interface IIngredientMapMutable<T,M,V>
- Type Parameters:
T- The instance type.M- The matching condition parameter.V- The type of mapped values.
- All Superinterfaces:
IIngredientCollectionLike<T,,M, Map.Entry<T, V>> IIngredientMap<T,,M, V> Iterable<Map.Entry<T,V>>
- All Known Implementing Classes:
IngredientHashMap,IngredientMapAdapter,IngredientMapMultiClassified,IngredientMapSingleClassified,IngredientMapWrappedAdapter,IngredientTreeMap
A mutable mapping from ingredient component instances to values of any type.
This does not conform to the
Map interface
as instances are compared using the matcher in IngredientComponent.getMatcher().-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears this map of all instances.Add a new entry.default intputAll(IIngredientMap<? extends T, M, ? extends V> map) Add all entries from the given map to this map.Remove the mapping for the given key instance.default intRemove all the given key instances from the collection.default intRemove all occurrences of the given instances under the given match conditions.intRemove all occurrences of the given key instance under the given match conditions.Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionLike
equals, getComponent, hashCode, isEmpty, iterator, size, toStringMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientMap
containsKey, containsKey, containsKeyAll, containsKeyAll, containsValue, countKey, entrySet, get, getAll, keySet, keySet, valuesMethods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
clear
void clear()Clears this map of all instances. -
put
Add a new entry.- Parameters:
key- An instance key.value- A value.- Returns:
- The previous value that was associated with the given instance.
-
remove
Remove the mapping for the given key instance.- Parameters:
key- An instance key.- Returns:
- The value that was associated with the given instance.
-
removeAll
Remove all occurrences of the given key instance under the given match conditions. This instance will be compared based on the matcher from the ingredient component type using the given match condition.- Parameters:
instance- An instance.matchCondition- A match condition.- Returns:
- The number of removed instances.
-
removeAll
Remove all the given key instances from the collection.- Parameters:
instances- Instances.- Returns:
- The number of removed instances.
-
removeAll
Remove all occurrences of the given instances under the given match conditions. The instances will be compared based on the matcher from the ingredient component type using the given match condition.- Parameters:
instances- Instances.matchCondition- A match condition.- Returns:
- The number of removed instances.
-
putAll
Add all entries from the given map to this map.- Parameters:
map- A map, that will not be changed, only read.- Returns:
- The amount of entries from the given map that were added to this map.
-