Package org.spongepowered.api.data.value
Interface CollectionValue.Immutable<E,C extends Collection<E>,I extends CollectionValue.Immutable<E,C,I,M>,M extends CollectionValue.Mutable<E,C,M,I>>
- Type Parameters:
E- The type of elementC- The type ofCollectionI- The extendedCollectionValue.Immutablefor self referencingM- The mutableCollectionValue.Mutablecounterpart forasMutable()
- All Superinterfaces:
CollectionValue<E,,C> Iterable<E>,Value<C>,Value.Immutable<C>
- All Known Subinterfaces:
ListValue.Immutable<E>,SetValue.Immutable<E>,WeightedCollectionValue.Immutable<E>
- Enclosing interface:
CollectionValue<E,C extends Collection<E>>
public static interface CollectionValue.Immutable<E,C extends Collection<E>,I extends CollectionValue.Immutable<E,C,I,M>,M extends CollectionValue.Mutable<E,C,M,I>>
extends Value.Immutable<C>, CollectionValue<E,C>
A
Value.Immutable type that handles a Collection of elements
type E. All of the methods provided for modification return new
instances of the same type. Likewise, the underlying ValueContainer
is not modified.-
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.Value
Value.Factory, Value.Immutable<E>, Value.Mutable<E> -
Method Summary
Modifier and TypeMethodDescriptiondefault IRetrieves an immutable form of this value.Creates a mutableValue.Mutablefor thisValue.Immutable.default MRetrieves a copy in the mutable form of this value.Retrieves the underlying value for thisValue.Immutableand applies the givenFunctiononto that value, after which, the product is sent to a newValue.Immutablereplacing this one.Creates a newValue.Immutablewith the givenEtyped value, such that if the owningValueContaineris immutable, theValueContainertoo is recreated as a new instance with the newValue.Immutable.Creates a newCollectionValue.Immutablewith the given elements along with any pre-existing values within this value.withElement(E element) Creates a newCollectionValue.Immutablewith the given values along with any pre-existing values within this value.Creates a newCollectionValue.Immutablewithout the givenEelement.withoutAll(Iterable<E> elements) Creates a newCollectionValue.Immutablewithout the given elements of the providedIterable.withoutAll(Predicate<E> predicate) Creates a newCollectionValue.Immutablewith elements that when the givenPredicateisPredicate.test(Object)on the element andtrueis returned, the element will remain in the newCollectionValue.Immutable.Methods inherited from interface org.spongepowered.api.data.value.CollectionValue
all, contains, containsAll, isEmpty, sizeMethods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
withElement
Creates a newCollectionValue.Immutablewith the given values along with any pre-existing values within this value.- Parameters:
element- The element to add- Returns:
- The new value
-
withAll
Creates a newCollectionValue.Immutablewith the given elements along with any pre-existing values within this value.- Parameters:
elements- The elements to add- Returns:
- The new value
- See Also:
-
without
Creates a newCollectionValue.Immutablewithout the givenEelement.- Parameters:
element- The element to exclude- Returns:
- The new value
-
withoutAll
Creates a newCollectionValue.Immutablewithout the given elements of the providedIterable.- Parameters:
elements- The elements to exclude- Returns:
- The new value
-
withoutAll
Creates a newCollectionValue.Immutablewith elements that when the givenPredicateisPredicate.test(Object)on the element andtrueis returned, the element will remain in the newCollectionValue.Immutable.- Parameters:
predicate- The predicate to apply- Returns:
- The new value
-
with
Description copied from interface:Value.ImmutableCreates a newValue.Immutablewith the givenEtyped value, such that if the owningValueContaineris immutable, theValueContainertoo is recreated as a new instance with the newValue.Immutable.- Specified by:
within interfaceValue.Immutable<E>- Parameters:
value- The value to replace- Returns:
- The owning
ValueContainer, a new instance if it too is immutable
-
transform
Description copied from interface:Value.ImmutableRetrieves the underlying value for thisValue.Immutableand applies the givenFunctiononto that value, after which, the product is sent to a newValue.Immutablereplacing this one.If the
ValueContainertoo is immutable, a new instance of theValueContainermay be created. If theValueContaineris mutable, the same instance of theValueContaineris retained.- Specified by:
transformin interfaceValue.Immutable<E>- Parameters:
function- The function to apply onto the existing value- Returns:
- The owning
ValueContainer, a new instance if it too is immutable
-
asMutable
M asMutable()Description copied from interface:Value.ImmutableCreates a mutableValue.Mutablefor thisValue.Immutable.- Specified by:
asMutablein interfaceCollectionValue<E,C extends Collection<E>> - Specified by:
asMutablein interfaceValue<E>- Specified by:
asMutablein interfaceValue.Immutable<E>- Returns:
- A mutable value
-
asMutableCopy
Description copied from interface:ValueRetrieves a copy in the mutable form of this value. The new is created with the same key and values.- Specified by:
asMutableCopyin interfaceCollectionValue<E,C extends Collection<E>> - Specified by:
asMutableCopyin interfaceValue<E>- Specified by:
asMutableCopyin 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,C extends Collection<E>> - Specified by:
asImmutablein interfaceValue<E>- Specified by:
asImmutablein interfaceValue.Immutable<E>- Returns:
- An immutable value
-