Class CouchbaseArrayList<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
com.couchbase.client.java.datastructures.collections.CouchbaseArrayList<E>
- Type Parameters:
E
- the type of values in the list.
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,List<E>
@Committed @Public public class CouchbaseArrayList<E> extends AbstractList<E>
A CouchbaseArrayList is a
List
backed by a Couchbase
document (more
specifically a JSON array
).
Note that as such, a CouchbaseArrayList is restricted to the types that a JSON array
can contain. JSON objects and sub-arrays can be represented as JsonObject
and JsonArray
respectively.- Since:
- 2.3.6
- Author:
- Simon Baslé, Subhashni Balakrishnan
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
Constructors Constructor Description CouchbaseArrayList(String id, Bucket bucket)
CouchbaseArrayList(String id, Bucket bucket, E... content)
CouchbaseArrayList(String id, Bucket bucket, Collection<? extends E> content)
-
Method Summary
Modifier and Type Method Description void
add(int index, E element)
void
clear()
boolean
contains(Object o)
E
get(int index)
boolean
isEmpty()
Iterator<E>
iterator()
ListIterator<E>
listIterator()
ListIterator<E>
listIterator(int index)
E
remove(int index)
E
set(int index, E element)
int
size()
Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, indexOf, lastIndexOf, removeRange, subList
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addAll, containsAll, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Constructor Details
-
CouchbaseArrayList
Create a newCouchbase-backed
List, backed by the document identified byid
inbucket
. Note that if the document already exists, its content will be used as initial content for this collection. Otherwise it is created empty.- Parameters:
id
- the id of the Couchbase document to back the list.bucket
- theBucket
through which to interact with the document.
-
CouchbaseArrayList
Create a newCouchbase-backed
List, backed by the document identified byid
inbucket
. 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, theCouchbaseArrayList(String, Bucket)
constructor will be invoked instead, which will use pre-existing values as content. To create a new List and force it to be empty, useCouchbaseArrayList(String, Bucket, Collection)
with an empty collection.- Parameters:
id
- the id of the Couchbase document to back the list.bucket
- theBucket
through which to interact with the document.content
- vararg of the elements to initially store in the List.
-
CouchbaseArrayList
Create a newCouchbase-backed
List, backed by the document identified byid
inbucket
. Note that if the document already exists, its content is reset to the values provided in thecontent
Collection.- Parameters:
id
- the id of the Couchbase document to back the list.bucket
- theBucket
through which to interact with the document.content
- collection of the elements to initially store in the List.
-
-
Method Details
-
get
-
size
public int size()- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceList<E>
- Specified by:
size
in classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<E>
- Specified by:
isEmpty
in interfaceList<E>
- Overrides:
isEmpty
in classAbstractCollection<E>
-
set
-
add
-
remove
-
contains
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceList<E>
- Overrides:
contains
in classAbstractCollection<E>
-
iterator
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
- Overrides:
listIterator
in classAbstractList<E>
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
- Overrides:
listIterator
in classAbstractList<E>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
- Specified by:
clear
in interfaceList<E>
- Overrides:
clear
in classAbstractList<E>
-