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
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 TypeMethodDescriptionboolean
Check if this collection contains the given instance.boolean
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 the number of occurrences of the given instance under the given match conditions.An iterator over this collection over all occurrences of the given instance under the given match conditions.default Spliterator<T>
stream()
default T[]
toArray()
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
-
Method Details
-
contains
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
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
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
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
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
An iterator over this collection over all occurrences of the given instance under the given match conditions.- Specified by:
iterator
in interfaceIIngredientCollectionLike<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
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
- Specified by:
spliterator
in interfaceIterable<T>
-
stream
- Returns:
- A stream for all ingredients in this collection.
-
parallelStream
- Returns:
- A parallel stream for all ingredients in this collection.
-