Class IngredientList<T,M>
java.lang.Object
org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionAdapter<T,M>
org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionCollectionAdapter<T,M,List<T>>
org.cyclops.cyclopscore.ingredient.collection.IngredientList<T,M>
- Type Parameters:
T
- The instance type.M
- The matching condition parameter.
- All Implemented Interfaces:
Iterable<T>
,IIngredientCollection<T,
,M> IIngredientCollectionLike<T,
,M, T> IIngredientCollectionMutable<T,
,M> IIngredientList<T,
,M> IIngredientListMutable<T,
M>
- Direct Known Subclasses:
IngredientArrayList
,IngredientLinkedList
public class IngredientList<T,M>
extends IngredientCollectionCollectionAdapter<T,M,List<T>>
implements IIngredientListMutable<T,M>
A mutable ingredient collection using list semantics.
This means that instances exist in a predefined order and that instances can exist multiple time in the collection.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Insert the given instance at the given position and shift all instances after it (if any) to the right (add one to their index).boolean
Check if this collection equals the given object.int
firstIndexOf
(T instance) The first index that has an instance that equals the given instance.get
(int index) Get the instance at the given index.int
lastIndexOf
(T instance) The last index that has an instance that equals the given instance.listIterator
(int offset) Get the offsetted list index.remove
(int index) Remove the instance at the given index.Set the instance at the given index.subList
(int fromIndex, int toIndex) Get a view of a sublist of the this list.Methods inherited from class org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionCollectionAdapter
add, clear, getCollection, iterator, size
Methods inherited from class org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionAdapter
contains, contains, count, getComponent, hashCode, iterator, remove, removeAll, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollection
contains, contains, containsAll, containsAll, count, iterator, parallelStream, stream, toArray
Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionLike
getComponent, hashCode, isEmpty, size, toString
Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionMutable
add, addAll, clear, remove, removeAll, removeAll, removeAll
Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientList
sort, spliterator
-
Constructor Details
-
IngredientList
-
-
Method Details
-
equals
Description copied from interface:IIngredientCollectionLike
Check if this collection equals the given object. -
get
Description copied from interface:IIngredientList
Get the instance at the given index.- Specified by:
get
in interfaceIIngredientList<T,
M> - Parameters:
index
- An index.- Returns:
- The instance at the given index.
-
set
Description copied from interface:IIngredientList
Set the instance at the given index.- Specified by:
set
in interfaceIIngredientList<T,
M> - Parameters:
index
- An index.instance
- The instance to set.- Returns:
- The previous instance at the given position.
-
add
Description copied from interface:IIngredientList
Insert the given instance at the given position and shift all instances after it (if any) to the right (add one to their index).- Specified by:
add
in interfaceIIngredientList<T,
M> - Parameters:
index
- An index.instance
- The instances to add.
-
remove
Description copied from interface:IIngredientList
Remove the instance at the given index. All following instances (with higher index; if any) will be shifted to the left (subtract one from their index).- Specified by:
remove
in interfaceIIngredientList<T,
M> - Parameters:
index
- An index.- Returns:
- The removed index if one existed.
-
firstIndexOf
Description copied from interface:IIngredientList
The first index that has an instance that equals the given instance.- Specified by:
firstIndexOf
in interfaceIIngredientList<T,
M> - Parameters:
instance
- An instance.- Returns:
- The first matching instance's index, or -1 if none.
-
lastIndexOf
Description copied from interface:IIngredientList
The last index that has an instance that equals the given instance.- Specified by:
lastIndexOf
in interfaceIIngredientList<T,
M> - Parameters:
instance
- An instance.- Returns:
- The last matching instance's index, or -1 if none.
-
listIterator
- Specified by:
listIterator
in interfaceIIngredientList<T,
M> - Returns:
- A list iterator over all instances.
-
listIterator
Description copied from interface:IIngredientList
Get the offsetted list index.- Specified by:
listIterator
in interfaceIIngredientList<T,
M> - Parameters:
offset
- An index to start iterating from.- Returns:
- A list iterator that is offsetted by `offset` instances.
-
subList
Description copied from interface:IIngredientList
Get a view of a sublist of the this list. As this is a view, any mutations on it will reflect on this list as well.- Specified by:
subList
in interfaceIIngredientList<T,
M> - Parameters:
fromIndex
- The starting index (inclusive).toIndex
- The ending index (exclusive).- Returns:
- The sublist view.
-