T
- the type of values in the set.@InterfaceStability.Experimental @InterfaceAudience.Public public class CouchbaseArraySet<T> extends AbstractSet<T>
A CouchbaseArraySet is a Set
backed by a Couchbase
document (more specifically a JSON array
).
Note that a CouchbaseArraySet is restricted to primitive types (the types that a JSON array
can contain, except JsonObject
and JsonArray
). null entries are supported.
Constructor and Description |
---|
CouchbaseArraySet(String id,
Bucket bucket)
Create a new
CouchbaseArraySet , backed by the document identified by id in the given Couchbase bucket . |
CouchbaseArraySet(String id,
Bucket bucket,
Set<? extends T> initialData)
Create a new
CouchbaseArraySet , backed by the document identified by id in the given Couchbase bucket . |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T t) |
void |
clear() |
boolean |
contains(Object t) |
protected void |
enforcePrimitive(Object t)
Verify that the type of object t is compatible with CouchbaseArraySet storage.
|
boolean |
isEmpty() |
Iterator<T> |
iterator() |
boolean |
remove(Object t) |
protected boolean |
safeEquals(Object expected,
Object tested) |
int |
size() |
equals, hashCode, removeAll
addAll, containsAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, containsAll, of, of, of, of, of, of, of, of, of, of, of, of, retainAll, spliterator, toArray, toArray
parallelStream, removeIf, stream
public CouchbaseArraySet(String id, Bucket bucket)
Create a new CouchbaseArraySet
, backed by the document identified by id
in the given Couchbase 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 set.bucket
- the Bucket
through which to interact with the document.public CouchbaseArraySet(String id, Bucket bucket, Set<? extends T> initialData)
Create a new CouchbaseArraySet
, backed by the document identified by id
in the given Couchbase bucket
. Note that if the document already exists, its content is reset to the values copied from the given data
Map.
A null or empty data map will re-initialize any pre-existing document to an empty content.
id
- the id of the Couchbase document to back the set.bucket
- the Bucket
through which to interact with the document.initialData
- Set of the elements to initially store in the CouchbaseArraySet.public int size()
size
in interface Collection<T>
size
in interface Set<T>
size
in class AbstractCollection<T>
public boolean isEmpty()
isEmpty
in interface Collection<T>
isEmpty
in interface Set<T>
isEmpty
in class AbstractCollection<T>
public boolean contains(Object t)
contains
in interface Collection<T>
contains
in interface Set<T>
contains
in class AbstractCollection<T>
public boolean add(T t)
add
in interface Collection<T>
add
in interface Set<T>
add
in class AbstractCollection<T>
public boolean remove(Object t)
remove
in interface Collection<T>
remove
in interface Set<T>
remove
in class AbstractCollection<T>
public void clear()
clear
in interface Collection<T>
clear
in interface Set<T>
clear
in class AbstractCollection<T>
protected void enforcePrimitive(Object t) throws ClassCastException
Verify that the type of object t is compatible with CouchbaseArraySet storage.
t
- the object to check.ClassCastException
- if the object is incompatible.Copyright © 2015 Couchbase, Inc.