Package io.atomix.client.collection
Interface AsyncDistributedCollection<E>
- All Superinterfaces:
AsyncIterable<E>,AsyncPrimitive,DistributedPrimitive
- All Known Subinterfaces:
AsyncDistributedMultiset<E>,AsyncDistributedSet<E>
Asynchronous distributed collection.
-
Field Summary
Fields inherited from interface io.atomix.client.DistributedPrimitive
DEFAULT_OPERATION_TIMEOUT_MILLIS -
Method Summary
Modifier and TypeMethodDescriptionAdds the specified element to this collection if it is not already present (optional operation).addAll(Collection<? extends E> c) Adds all of the elements in the specified collection to this collection if they're not already present (optional operation).clear()Removes all elements from the collection.Returns if this collection contains the specified element.containsAll(Collection<? extends E> c) Returns if this collection contains all the elements in specified collection.isEmpty()Returns if the collection is empty.default CompletableFuture<Cancellable>listen(CollectionEventListener<E> listener) Registers the specified listener to be notified whenever the collection is updated.listen(CollectionEventListener<E> listener, Executor executor) Registers the specified listener to be notified whenever the collection is updated.Removes the specified element to this collection if it is present (optional operation).removeAll(Collection<? extends E> c) Removes from this collection all of its elements that are contained in the specified collection (optional operation).retainAll(Collection<? extends E> c) Retains only the elements in this collection that are contained in the specified collection (optional operation).size()Returns the number of elements in the collection.default DistributedCollection<E>sync()Returns a synchronous wrapper around the asynchronous primitive.Returns a synchronous wrapper around the asynchronous primitive.Methods inherited from interface io.atomix.client.iterator.AsyncIterable
iterator, streamMethods inherited from interface io.atomix.client.AsyncPrimitive
closeMethods inherited from interface io.atomix.client.DistributedPrimitive
name
-
Method Details
-
add
Adds the specified element to this collection if it is not already present (optional operation).- Parameters:
element- element to add- Returns:
trueif this collection did not already contain the specified element.
-
remove
Removes the specified element to this collection if it is present (optional operation).- Parameters:
element- element to remove- Returns:
trueif this collection contained the specified element
-
size
CompletableFuture<Integer> size()Returns the number of elements in the collection.- Returns:
- size of the collection
-
isEmpty
CompletableFuture<Boolean> isEmpty()Returns if the collection is empty.- Returns:
trueif this collection is empty
-
clear
CompletableFuture<Void> clear()Removes all elements from the collection.- Returns:
- CompletableFuture that is completed when the operation completes
-
contains
Returns if this collection contains the specified element.- Parameters:
element- element to check- Returns:
trueif this collection contains the specified element
-
addAll
Adds all of the elements in the specified collection to this collection if they're not already present (optional operation).- Parameters:
c- collection containing elements to be added to this collection- Returns:
trueif this collection contains all elements in the collection
-
containsAll
Returns if this collection contains all the elements in specified collection.- Parameters:
c- collection- Returns:
trueif this collection contains all elements in the collection
-
retainAll
Retains only the elements in this collection that are contained in the specified collection (optional operation).- Parameters:
c- collection containing elements to be retained in this collection- Returns:
trueif this collection changed as a result of the call
-
removeAll
Removes from this collection all of its elements that are contained in the specified collection (optional operation).- Parameters:
c- collection containing elements to be removed from this collection- Returns:
trueif this collection changed as a result of the call
-
listen
Registers the specified listener to be notified whenever the collection is updated.- Parameters:
listener- listener to notify about collection update events- Returns:
- CompletableFuture that is completed when the operation completes
-
listen
Registers the specified listener to be notified whenever the collection is updated.- Parameters:
listener- listener to notify about collection update eventsexecutor- executor on which to call event listener- Returns:
- CompletableFuture that is completed when the operation completes
-
sync
Description copied from interface:AsyncPrimitiveReturns a synchronous wrapper around the asynchronous primitive.- Specified by:
syncin interfaceAsyncPrimitive- Returns:
- the synchronous primitive
-
sync
Description copied from interface:AsyncPrimitiveReturns a synchronous wrapper around the asynchronous primitive.- Specified by:
syncin interfaceAsyncPrimitive- Parameters:
operationTimeout- the synchronous operation timeout- Returns:
- the synchronous primitive
-