Interface MutableResourceList
- All Superinterfaces:
ResourceList
- All Known Implementing Classes:
AbstractProxyMutableResourceList,FuzzyResourceListImpl,LazyCopyMutableResourceList,ListenableResourceList,MutableResourceListImpl
@API(status=STABLE,
since="2.0.0-milestone.1.2")
public interface MutableResourceList
extends ResourceList
Mutable variant of
ResourceList.
Implementation can be found in MutableResourceListImpl.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordRepresents the result of an operation in aMutableResourceList. -
Method Summary
Modifier and TypeMethodDescriptionadd(ResourceAmount resourceAmount) Adds a given resource to the list.add(ResourceKey resource, long amount) Adds a given resource to the list.voidclear()Clears the list.copy()Copies the list.remove(ResourceAmount resourceAmount) Removes as much of a certain amount of a resource in the list.remove(ResourceKey resource, long amount) Removes as much of a certain amount of a resource in the list.
-
Method Details
-
add
Adds a given resource to the list.- Parameters:
resource- the resource, may not be nullamount- the amount, must be larger than 0- Returns:
- the result of the operation
-
add
Adds a given resource to the list. Shorthand foradd(ResourceKey, long).- Parameters:
resourceAmount- the resource and the amount- Returns:
- the result of the operation
-
remove
Removes as much of a certain amount of a resource in the list. If the amount reaches 0 due to this removal, the resource is removed from the list.- Parameters:
resource- the resource, may not be nullamount- the amount, must be larger than 0- Returns:
- a result if the removal operation was successful, otherwise null
-
remove
Removes as much of a certain amount of a resource in the list. If the amount reaches 0 due to this removal, the resource is removed from the list. Shorthand forremove(ResourceKey, long).- Parameters:
resourceAmount- the resource and the amount- Returns:
- a result if the removal operation was successful, otherwise null
-
clear
void clear()Clears the list. -
copy
MutableResourceList copy()Copies the list.
-