Interface IIngredientCollectionMutable<T,M>

Type Parameters:
T - The instance type.
M - The matching condition parameter.
All Superinterfaces:
IIngredientCollection<T,M>, IIngredientCollectionLike<T,M,T>, Iterable<T>
All Known Subinterfaces:
IIngredientCollapsedCollectionMutable<T,M>, IIngredientListMutable<T,M>, IIngredientSetMutable<T,M>
All Known Implementing Classes:
IngredientArrayList, IngredientCollectionAdapter, IngredientCollectionCollectionAdapter, IngredientCollectionCollectionWrappedAdapter, IngredientCollectionMultiClassified, IngredientCollectionMutableWrapper, IngredientCollectionPrototypeMap, IngredientCollectionQuantitativeGrouper, IngredientCollectionSingleClassified, IngredientCollectionSingleClassifiedCollapsed, IngredientHashSet, IngredientLinkedList, IngredientList, IngredientSet, IngredientTreeSet

public interface IIngredientCollectionMutable<T,M> extends IIngredientCollection<T,M>
A mutable collection of ingredient component instances. This does not conform to the Collection interface as instances are compared using the matcher in IngredientComponent.getMatcher().
  • Method Details

    • add

      boolean add(T instance)
      Add the given instance to the collection.
      Parameters:
      instance - An instance.
      Returns:
      If the collection was changed due to this addition. This can be false in the case of sets in which each instance can only exists once.
    • addAll

      default boolean addAll(Iterable<? extends T> instances)
      Add the given instances to the collection.
      Parameters:
      instances - Instances.
      Returns:
      If the collection was changed due to this addition. This can be false in the case of sets in which each instance can only exists once.
    • remove

      boolean remove(T instance)
      Remove the given instance from the collection.
      Parameters:
      instance - An instance.
      Returns:
      If the collection was changed due to this addition. Can be false if the collection did not contain the instance.
    • removeAll

      int removeAll(T instance, M matchCondition)
      Remove all occurrences of the given 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 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.
    • clear

      void clear()
      Clears this collection of all instances.