Package org.spongepowered.api.data.value
Interface ListValue.Immutable<E>
- Type Parameters:
E- The type of element of this list value
- All Superinterfaces:
CollectionValue<E,,List<E>> CollectionValue.Immutable<E,,List<E>, ListValue.Immutable<E>, ListValue.Mutable<E>> Iterable<E>,ListValue<E>,Value<List<E>>,Value.Immutable<List<E>>
public static interface ListValue.Immutable<E>
extends ListValue<E>, CollectionValue.Immutable<E,List<E>,ListValue.Immutable<E>,ListValue.Mutable<E>>
A type of
CollectionValue.Immutable that is backed by a List.
All "with" and "Without" methods are returning new instances as every
instance is immutable.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.spongepowered.api.data.value.CollectionValue
CollectionValue.Immutable<E,C extends Collection<E>, I extends CollectionValue.Immutable<E, C, I, M>, M extends CollectionValue.Mutable<E, C, M, I>>, CollectionValue.Mutable<E, C extends Collection<E>, M extends CollectionValue.Mutable<E, C, M, I>, I extends CollectionValue.Immutable<E, C, I, M>> Nested classes/interfaces inherited from interface org.spongepowered.api.data.value.ListValue
ListValue.Immutable<E>, ListValue.Mutable<E>Nested classes/interfaces inherited from interface org.spongepowered.api.data.value.Value
Value.Factory, Value.Immutable<E>, Value.Mutable<E> -
Method Summary
Modifier and TypeMethodDescriptiondefault ListValue.Immutable<E> Retrieves an immutable form of this value.Retrieves a mutable form of this value.Creates a newListValue.Immutablewith the desired element at the desired index.Creates a newListValue.Immutablewith the specified element at the specified position in the list.Creates a newListValue.Immutablewith the specified elements in the order that they are iterated to the list at the specified index.without(int index) Creates a newListValue.Immutablewithout the element at the specified index.Methods inherited from interface org.spongepowered.api.data.value.CollectionValue
all, asMutableCopy, contains, containsAll, isEmpty, sizeMethods inherited from interface org.spongepowered.api.data.value.CollectionValue.Immutable
asMutableCopy, transform, with, withAll, withElement, without, withoutAll, withoutAllMethods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
with
Creates a newListValue.Immutablewith the specified element at the specified position in the list. As well, the element at the provided index is shifted to the right, increasing its and the elements thereafter their indices by one.- Parameters:
index- The index to add the provided element atvalue- The element to add- Returns:
- The new value, for chaining
-
with
Creates a newListValue.Immutablewith the specified elements in the order that they are iterated to the list at the specified index. The element at the provided index and elements thereafter are shifted to the right, increasing their indices by one.- Parameters:
index- The index to add the elements atvalues- The elements to add- Returns:
- The new value, for chaining
-
without
Creates a newListValue.Immutablewithout the element at the specified index. Shifts any subsequent elements to the left, subtracts one from their indices.- Parameters:
index- The index of the element to exclude- Returns:
- The new value, for chaining
-
set
Creates a newListValue.Immutablewith the desired element at the desired index.- Parameters:
index- The index to replace the elementelement- The element to include at the index- Returns:
- The new value, for chaining
-
asMutable
ListValue.Mutable<E> asMutable()Description copied from interface:ValueRetrieves a mutable form of this value. Due to the vague nature of the value itself, some cases can already provide aValue.Mutableinstance where this would simply return itself. In other cases, where the retrieved value is anValue.Immutableinstance, a new mutable value is created with the same key and values.- Specified by:
asMutablein interfaceCollectionValue<E,List<E>> - Specified by:
asMutablein interfaceCollectionValue.Immutable<E,List<E>, ListValue.Immutable<E>, ListValue.Mutable<E>> - Specified by:
asMutablein interfaceListValue<E>- Specified by:
asMutablein interfaceValue<E>- Specified by:
asMutablein interfaceValue.Immutable<E>- Returns:
- A mutable value
-
asImmutable
Description copied from interface:ValueRetrieves an immutable form of this value. Due to the vague nature of the value itself, some cases can already provide aValue.Immutableinstance where this would simply return itself. In other cases, where the retrieved value is aValue.Mutableinstance, a new immutable value is created with the same key and values.- Specified by:
asImmutablein interfaceCollectionValue<E,List<E>> - Specified by:
asImmutablein interfaceCollectionValue.Immutable<E,List<E>, ListValue.Immutable<E>, ListValue.Mutable<E>> - Specified by:
asImmutablein interfaceListValue<E>- Specified by:
asImmutablein interfaceValue<E>- Specified by:
asImmutablein interfaceValue.Immutable<E>- Returns:
- An immutable value
-