Class IngredientMapWrappedAdapter<T,M,V,C extends Map<IngredientInstanceWrapper<T,M>,V>>
java.lang.Object
org.cyclops.cyclopscore.ingredient.collection.IngredientMapAdapter<T,M,V>
org.cyclops.cyclopscore.ingredient.collection.IngredientMapWrappedAdapter<T,M,V,C>
- Type Parameters:
T- The instance type.M- The matching condition parameter.V- The type of mapped values.
- All Implemented Interfaces:
Iterable<Map.Entry<T,,V>> IIngredientCollectionLike<T,,M, Map.Entry<T, V>> IIngredientMap<T,,M, V> IIngredientMapMutable<T,M, V>
- Direct Known Subclasses:
IngredientHashMap,IngredientTreeMap
public abstract class IngredientMapWrappedAdapter<T,M,V,C extends Map<IngredientInstanceWrapper<T,M>,V>>
extends IngredientMapAdapter<T,M,V>
An abstract ingredient map adapter.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIngredientMapWrappedAdapter(IngredientComponent<T, M> component, C collection) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears this map of all instances.Compute a new value for the given key instance, followingMap.compute(K, java.util.function.BiFunction<? super K, ? super V, ? extends V>)semantics.booleancontainsValue(V value) Check if this map contains the given value.Get the value for the given instance.protected Citerator()keySet()Add a new entry.Remove the mapping for the given key instance.intsize()values()protected IngredientInstanceWrapper<T, M> Methods inherited from class org.cyclops.cyclopscore.ingredient.collection.IngredientMapAdapter
entrySet, equals, getAll, getComponent, hashCode, iterator, keySet, removeAll, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionLike
isEmptyMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientMap
containsKey, containsKey, containsKeyAll, containsKeyAll, countKeyMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientMapMutable
putAll, removeAll, removeAllMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
IngredientMapWrappedAdapter
-
-
Method Details
-
getCollection
-
wrap
-
clear
public void clear()Description copied from interface:IIngredientMapMutableClears this map of all instances. -
put
Description copied from interface:IIngredientMapMutableAdd a new entry.- Parameters:
key- An instance key.value- A value.- Returns:
- The previous value that was associated with the given instance.
-
remove
Description copied from interface:IIngredientMapMutableRemove the mapping for the given key instance.- Parameters:
key- An instance key.- Returns:
- The value that was associated with the given instance.
-
size
public int size()- Returns:
- The number of instances contained in this collection.
-
containsValue
Description copied from interface:IIngredientMapCheck if this map contains the given value.- Parameters:
value- A value.- Returns:
- If this map contains the given value.
-
get
Description copied from interface:IIngredientMapGet the value for the given instance.- Parameters:
key- An instance.- Returns:
- The value.
-
compute
Description copied from interface:IIngredientMapMutableCompute a new value for the given key instance, followingMap.compute(K, java.util.function.BiFunction<? super K, ? super V, ? extends V>)semantics. The remapping function is passed the key and the currently mapped value, or null when the key is absent. Returning null removes the mapping, returning anything else stores it. Implementations back onto a hash of the key instance, which for some component types is expensive. Doing this in one call rather than a get followed by a put lets them hash once.- Parameters:
key- An instance key.remappingFunction- A function computing the new value from the key and the old value.- Returns:
- The new value associated with the key, or null if none.
-
keySet
- Returns:
- All key instances.
-
values
- Returns:
- All values.
-
iterator
-