Interface IIngredientCollection<T,M>

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

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

    Modifier and Type
    Method
    Description
    boolean
    contains(T instance)
    Check if this collection contains the given instance.
    boolean
    contains(T instance, M matchCondition)
    Check if this collection contains the given instance under the given match conditions.
    default boolean
    containsAll(Iterable<? extends T> instances)
    Check if this collection contains all the given instances.
    default boolean
    containsAll(Iterable<? extends T> instances, M matchCondition)
    Check if this collection contains all the given instances under the given match conditions.
    int
    count(T instance, M matchCondition)
    Count the number of occurrences of the given instance under the given match conditions.
    iterator(T instance, M matchCondition)
    An iterator over this collection over all occurrences of the given instance under the given match conditions.
    default Stream<T>
     
    default Spliterator<T>
     
    default Stream<T>
     
    default T[]
    Returns an array containing all of the elements in this collection in the internal sequence (from first to last element).

    Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionLike

    equals, getComponent, hashCode, isEmpty, size, toString

    Methods inherited from interface java.lang.Iterable

    forEach, iterator
  • Method Details

    • contains

      boolean contains(T instance)
      Check if this collection contains the given instance. This instance will be compared based on the matcher from the ingredient component type.
      Parameters:
      instance - An instance.
      Returns:
      If this collection contains the given instance.
    • contains

      boolean contains(T instance, M matchCondition)
      Check if this collection contains 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:
      If this collection contains the given instance under the given match conditions.
    • containsAll

      default boolean containsAll(Iterable<? extends T> instances)
      Check if this collection contains all the given instances. The instances will be compared based on the matcher from the ingredient component type.
      Parameters:
      instances - Instances.
      Returns:
      If this collection contains all the given instances.
    • containsAll

      default boolean containsAll(Iterable<? extends T> instances, M matchCondition)
      Check if this collection contains all 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:
      If this collection contains all the given instances under the given match conditions.
    • count

      int count(T instance, M matchCondition)
      Count the number of 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 occurrences of the given instance under the given match conditions.
    • iterator

      Iterator<T> iterator(T instance, M matchCondition)
      An iterator over this collection over all occurrences of the given instance under the given match conditions.
      Specified by:
      iterator in interface IIngredientCollectionLike<T,M,T>
      Parameters:
      instance - An instance.
      matchCondition - A match condition.
      Returns:
      An iterator over this collection over all occurrences of the given instance under the given match conditions.
    • toArray

      default T[] toArray()
      Returns an array containing all of the elements in this collection in the internal sequence (from first to last element). Each call of this method will return a new array copy.
      Returns:
      an array containing all of the elements in this collection in the internal sequence.
    • spliterator

      default Spliterator<T> spliterator()
      Specified by:
      spliterator in interface Iterable<T>
    • stream

      default Stream<T> stream()
      Returns:
      A stream for all ingredients in this collection.
    • parallelStream

      default Stream<T> parallelStream()
      Returns:
      A parallel stream for all ingredients in this collection.