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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInsert the given instance at the given position and shift all instances after it (if any) to the right (add one to their index).booleanCheck if this collection equals the given object.intfirstIndexOf(T instance) The first index that has an instance that equals the given instance.get(int index) Get the instance at the given index.intlastIndexOf(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, sizeMethods inherited from class org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionAdapter
contains, contains, count, getComponent, hashCode, iterator, remove, removeAll, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollection
contains, contains, containsAll, containsAll, count, iterator, parallelStream, stream, toArrayMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionLike
getComponent, hashCode, isEmpty, size, toStringMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionMutable
add, addAll, clear, remove, removeAll, removeAll, removeAllMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientList
sort, spliterator
-
Constructor Details
-
IngredientList
-
-
Method Details
-
equals
Description copied from interface:IIngredientCollectionLikeCheck if this collection equals the given object. -
get
Description copied from interface:IIngredientListGet the instance at the given index.- Specified by:
getin interfaceIIngredientList<T,M> - Parameters:
index- An index.- Returns:
- The instance at the given index.
-
set
Description copied from interface:IIngredientListSet the instance at the given index.- Specified by:
setin 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:IIngredientListInsert 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:
addin interfaceIIngredientList<T,M> - Parameters:
index- An index.instance- The instances to add.
-
remove
Description copied from interface:IIngredientListRemove 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:
removein interfaceIIngredientList<T,M> - Parameters:
index- An index.- Returns:
- The removed index if one existed.
-
firstIndexOf
Description copied from interface:IIngredientListThe first index that has an instance that equals the given instance.- Specified by:
firstIndexOfin interfaceIIngredientList<T,M> - Parameters:
instance- An instance.- Returns:
- The first matching instance's index, or -1 if none.
-
lastIndexOf
Description copied from interface:IIngredientListThe last index that has an instance that equals the given instance.- Specified by:
lastIndexOfin interfaceIIngredientList<T,M> - Parameters:
instance- An instance.- Returns:
- The last matching instance's index, or -1 if none.
-
listIterator
- Specified by:
listIteratorin interfaceIIngredientList<T,M> - Returns:
- A list iterator over all instances.
-
listIterator
Description copied from interface:IIngredientListGet the offsetted list index.- Specified by:
listIteratorin 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:IIngredientListGet 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:
subListin interfaceIIngredientList<T,M> - Parameters:
fromIndex- The starting index (inclusive).toIndex- The ending index (exclusive).- Returns:
- The sublist view.
-