Package org.spongepowered.api.data.value
Interface ListValue.Mutable<E>
- Type Parameters:
E
- The type of element of this list value
- All Superinterfaces:
CollectionValue<E,
,List<E>> CollectionValue.Mutable<E,
,List<E>, ListValue.Mutable<E>, ListValue.Immutable<E>> Iterable<E>
,ListValue<E>
,Value<List<E>>
,Value.Mutable<List<E>>
public static interface ListValue.Mutable<E>
extends ListValue<E>, CollectionValue.Mutable<E,List<E>,ListValue.Mutable<E>,ListValue.Immutable<E>>
A type of
CollectionValue.Mutable
that is backed by a List
. All
mutator methods provided are similar to those existing in List
with
the difference of returning itself, for fluency.-
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 TypeMethodDescriptionAdds the specified element at the specified position in the list.Adds the specified elements in the order that they are iterated to the list at the specified index.Retrieves an immutable form of this value.default ListValue.Mutable<E>
Retrieves a mutable form of this value.remove
(int index) Removes the element at the specified position in this list (optional operation).Replaces the element at the specified index in this list with the specified element.Methods inherited from interface org.spongepowered.api.data.value.CollectionValue
all, asMutableCopy, contains, containsAll, isEmpty, size
Methods inherited from interface org.spongepowered.api.data.value.CollectionValue.Mutable
add, addAll, asMutableCopy, copy, remove, removeAll, removeAll, set, transform
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
add
Adds 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:
- This value, for chaining
-
add
Adds 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:
- This value, for chaining
-
remove
Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left, subtracts one from their indices.- Parameters:
index
- The index of the element to remove- Returns:
- This value, for chaining
-
set
Replaces the element at the specified index in this list with the specified element.- Parameters:
index
- The index to replace the element withelement
- The element to set- Returns:
- This value, for chaining
-
asMutable
Description copied from interface:Value
Retrieves a mutable form of this value. Due to the vague nature of the value itself, some cases can already provide aValue.Mutable
instance where this would simply return itself. In other cases, where the retrieved value is anValue.Immutable
instance, a new mutable value is created with the same key and values.- Specified by:
asMutable
in interfaceCollectionValue<E,
List<E>> - Specified by:
asMutable
in interfaceCollectionValue.Mutable<E,
List<E>, ListValue.Mutable<E>, ListValue.Immutable<E>> - Specified by:
asMutable
in interfaceListValue<E>
- Specified by:
asMutable
in interfaceValue<E>
- Specified by:
asMutable
in interfaceValue.Mutable<E>
- Returns:
- A mutable value
-
asImmutable
ListValue.Immutable<E> asImmutable()Description copied from interface:Value
Retrieves an immutable form of this value. Due to the vague nature of the value itself, some cases can already provide aValue.Immutable
instance where this would simply return itself. In other cases, where the retrieved value is aValue.Mutable
instance, a new immutable value is created with the same key and values.- Specified by:
asImmutable
in interfaceCollectionValue<E,
List<E>> - Specified by:
asImmutable
in interfaceCollectionValue.Mutable<E,
List<E>, ListValue.Mutable<E>, ListValue.Immutable<E>> - Specified by:
asImmutable
in interfaceListValue<E>
- Specified by:
asImmutable
in interfaceValue<E>
- Specified by:
asImmutable
in interfaceValue.Mutable<E>
- Returns:
- An immutable value
-