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

public interface IIngredientMapMutable<T,M,V> extends IIngredientMap<T,M,V>
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 Details

    • clear

      void clear()
      Clears this map of all instances.
    • put

      @Nullable V put(T key, V value)
      Add a new entry.
      Parameters:
      key - An instance key.
      value - A value.
      Returns:
      The previous value that was associated with the given instance.
    • remove

      @Nullable V remove(T key)
      Remove the mapping for the given key instance.
      Parameters:
      key - An instance key.
      Returns:
      The value that was associated with the given instance.
    • removeAll

      int removeAll(T instance, M matchCondition)
      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

      default int removeAll(Iterable<? extends T> instances)
      Remove all the given key instances from the collection.
      Parameters:
      instances - Instances.
      Returns:
      The number of removed instances.
    • removeAll

      default int removeAll(Iterable<? extends T> instances, M matchCondition)
      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

      default int putAll(IIngredientMap<? extends T,M,? extends V> map)
      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.