Interface AsyncDistributedCollection<E>

All Superinterfaces:
AsyncIterable<E>, AsyncPrimitive, DistributedPrimitive
All Known Subinterfaces:
AsyncDistributedMultiset<E>, AsyncDistributedSet<E>

public interface AsyncDistributedCollection<E> extends AsyncPrimitive, AsyncIterable<E>
Asynchronous distributed collection.
  • Method Details

    • add

      CompletableFuture<Boolean> add(E element)
      Adds the specified element to this collection if it is not already present (optional operation).
      Parameters:
      element - element to add
      Returns:
      true if this collection did not already contain the specified element.
    • remove

      CompletableFuture<Boolean> remove(E element)
      Removes the specified element to this collection if it is present (optional operation).
      Parameters:
      element - element to remove
      Returns:
      true if this collection contained the specified element
    • size

      Returns the number of elements in the collection.
      Returns:
      size of the collection
    • isEmpty

      Returns if the collection is empty.
      Returns:
      true if this collection is empty
    • clear

      Removes all elements from the collection.
      Returns:
      CompletableFuture that is completed when the operation completes
    • contains

      CompletableFuture<Boolean> contains(E element)
      Returns if this collection contains the specified element.
      Parameters:
      element - element to check
      Returns:
      true if this collection contains the specified element
    • addAll

      CompletableFuture<Boolean> 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).
      Parameters:
      c - collection containing elements to be added to this collection
      Returns:
      true if this collection contains all elements in the collection
    • containsAll

      CompletableFuture<Boolean> containsAll(Collection<? extends E> c)
      Returns if this collection contains all the elements in specified collection.
      Parameters:
      c - collection
      Returns:
      true if this collection contains all elements in the collection
    • retainAll

      CompletableFuture<Boolean> retainAll(Collection<? extends E> c)
      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:
      true if this collection changed as a result of the call
    • removeAll

      CompletableFuture<Boolean> removeAll(Collection<? extends E> c)
      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:
      true if 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 events
      executor - executor on which to call event listener
      Returns:
      CompletableFuture that is completed when the operation completes
    • sync

      default DistributedCollection<E> sync()
      Description copied from interface: AsyncPrimitive
      Returns a synchronous wrapper around the asynchronous primitive.
      Specified by:
      sync in interface AsyncPrimitive
      Returns:
      the synchronous primitive
    • sync

      DistributedCollection<E> sync(Duration operationTimeout)
      Description copied from interface: AsyncPrimitive
      Returns a synchronous wrapper around the asynchronous primitive.
      Specified by:
      sync in interface AsyncPrimitive
      Parameters:
      operationTimeout - the synchronous operation timeout
      Returns:
      the synchronous primitive