Package org.spongepowered.api.data.value
Interface ListValue<E>
-
- All Superinterfaces:
CollectionValue<E,java.util.List<E>>
,java.lang.Iterable<E>
,Value<java.util.List<E>>
- All Known Subinterfaces:
ListValue.Immutable<E>
,ListValue.Mutable<E>
public interface ListValue<E> extends CollectionValue<E,java.util.List<E>>
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ListValue.Immutable<E>
A type ofCollectionValue.Immutable
that is backed by aList
.static interface
ListValue.Mutable<E>
A type ofCollectionValue.Mutable
that is backed by aList
.-
Nested classes/interfaces inherited from interface org.spongepowered.api.data.value.Value
Value.Factory
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description ListValue.Immutable<E>
asImmutable()
Retrieves an immutable form of this value.ListValue.Mutable<E>
asMutable()
Retrieves a mutable form of this value.E
get(int index)
Gets the desired element at the desired index.static <E> ListValue.Immutable<E>
immutableOf(java.util.function.Supplier<? extends Key<? extends ListValue<E>>> key, java.util.List<E> element)
static <E> ListValue.Immutable<E>
immutableOf(Key<? extends ListValue<E>> key, java.util.List<E> element)
int
indexOf(E element)
Queries for the index of the provided element.Key<? extends ListValue<E>>
key()
Gets the key for thisValue
.static <E> ListValue.Mutable<E>
mutableOf(java.util.function.Supplier<? extends Key<? extends ListValue<E>>> key, java.util.List<E> element)
static <E> ListValue.Mutable<E>
mutableOf(Key<? extends ListValue<E>> key, java.util.List<E> element)
-
Methods inherited from interface org.spongepowered.api.data.value.CollectionValue
all, asMutableCopy, contains, containsAll, isEmpty, size
-
-
-
-
Method Detail
-
mutableOf
static <E> ListValue.Mutable<E> mutableOf(Key<? extends ListValue<E>> key, java.util.List<E> element)
- Type Parameters:
E
- The element type- Parameters:
key
- The keyelement
- The element- Returns:
- The constructed mutable value
-
mutableOf
static <E> ListValue.Mutable<E> mutableOf(java.util.function.Supplier<? extends Key<? extends ListValue<E>>> key, java.util.List<E> element)
- Type Parameters:
E
- The element type- Parameters:
key
- The keyelement
- The element- Returns:
- The constructed mutable value
-
immutableOf
static <E> ListValue.Immutable<E> immutableOf(Key<? extends ListValue<E>> key, java.util.List<E> element)
- Type Parameters:
E
- The element type- Parameters:
key
- The keyelement
- The element- Returns:
- The constructed immutable value
-
immutableOf
static <E> ListValue.Immutable<E> immutableOf(java.util.function.Supplier<? extends Key<? extends ListValue<E>>> key, java.util.List<E> element)
- Type Parameters:
E
- The element type- Parameters:
key
- The keyelement
- The element- Returns:
- The constructed immutable value
-
key
Key<? extends ListValue<E>> key()
Description copied from interface:Value
Gets the key for thisValue
.
-
get
E get(int index)
Gets the desired element at the desired index.- Parameters:
index
- The index of the element to return- Returns:
- The element at the desired index
- Throws:
java.lang.IndexOutOfBoundsException
- if the index is out of range
-
indexOf
int indexOf(E element)
Queries for the index of the provided element. If the element is not contained in this list, -1 is returned.- Parameters:
element
- The element to get the index from- Returns:
- The index of the element, -1 if not available
-
asMutable
ListValue.Mutable<E> 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.
-
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,java.util.List<E>>
- Specified by:
asImmutable
in interfaceValue<E>
- Returns:
- An immutable value
-
-