@InterfaceStability.Experimental @InterfaceAudience.Public public class CouchbaseQueue<E> extends AbstractQueue<E>
A CouchbaseQueue is a Queue backed by a Couchbase document (more specifically a JSON array).
Note that as such, a CouchbaseQueue is restricted to the types that a JSON array can contain. JSON objects and sub-arrays can be represented as JsonObject and JsonArray respectively. Null values are not allowed as they have special meaning for the peek() and AbstractQueue.remove() methods of a queue.
| Constructor and Description |
|---|
CouchbaseQueue(String id,
Bucket bucket)
|
CouchbaseQueue(String id,
Bucket bucket,
Collection<? extends E> content)
|
CouchbaseQueue(String id,
Bucket bucket,
E... content)
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
Iterator<E> |
iterator() |
boolean |
offer(E e) |
E |
peek() |
E |
poll() |
int |
size() |
add, addAll, element, removecontains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArraypublic CouchbaseQueue(String id, Bucket bucket)
Create a new Couchbase-backed Queue, backed by the document identified by id in bucket. Note that if the document already exists, its content will be used as initial content for this collection. Otherwise it is created empty.
id - the id of the Couchbase document to back the queue.bucket - the Bucket through which to interact with the document.public CouchbaseQueue(String id, Bucket bucket, E... content)
Create a new Couchbase-backed Queue, backed by the document identified by id in bucket. Note that if the document already exists, its content is reset to the values provided.
Note that if you don’t provide any value as a vararg, the CouchbaseQueue(String, Bucket) constructor will be invoked instead, which will use pre-existing values as content. To create a new Queue and force it to be empty, use CouchbaseQueue(String, Bucket, Collection) with an empty collection.
id - the id of the Couchbase document to back the queue.bucket - the Bucket through which to interact with the document.content - vararg of the elements to initially store in the Queue.public CouchbaseQueue(String id, Bucket bucket, Collection<? extends E> content)
Create a new Couchbase-backed Queue, backed by the document identified by id in bucket. Note that if the document already exists, its content is reset to the values provided in the content Collection.
id - the id of the Couchbase document to back the queue.bucket - the Bucket through which to interact with the document.content - collection of the elements to initially store in the Queue, in iteration order.public Iterator<E> iterator()
iterator in interface Iterable<E>iterator in interface Collection<E>iterator in class AbstractCollection<E>public int size()
size in interface Collection<E>size in class AbstractCollection<E>public void clear()
clear in interface Collection<E>clear in class AbstractQueue<E>public boolean offer(E e)
public E poll()
public E peek()
Copyright © 2015 Couchbase, Inc.