Class CouchbaseArrayList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- com.couchbase.client.java.datastructures.CouchbaseArrayList<E>
-
- Type Parameters:
E- the type of values in the list.
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>
@Volatile public class CouchbaseArrayList<E> extends AbstractList<E>
A CouchbaseArrayList is aListbacked by aCouchbasedocument (more specifically aJSON array). Note that as such, a CouchbaseArrayList is restricted to the types that aJSON arraycan contain. JSON objects and sub-arrays can be represented asJsonObjectandJsonArrayrespectively.- Since:
- 2.3.6
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description CouchbaseArrayList(String id, Collection collection, Class<E> entityType, ArrayListOptions options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, E element)voidclear()booleancontains(Object o)Eget(int index)booleanisEmpty()Iterator<E>iterator()ListIterator<E>listIterator(int index)Eremove(int index)Eset(int index, E element)intsize()-
Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, indexOf, lastIndexOf, listIterator, 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 Detail
-
CouchbaseArrayList
public CouchbaseArrayList(String id, Collection collection, Class<E> entityType, ArrayListOptions options)
Create a newCouchbase-backedList, backed by the document identified byidincollection. 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.collection- theCollectionthrough which to interact with the document.entityType- a Class describing the type of objects in this Set.options- aArrayListOptionsto use for all operations on this instance of the list.
-
-
Method Detail
-
get
public E get(int index)
-
size
public int size()
- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceList<E>- Specified by:
sizein classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<E>- Specified by:
isEmptyin interfaceList<E>- Overrides:
isEmptyin classAbstractCollection<E>
-
add
public void add(int index, E element)
-
remove
public E remove(int index)
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceList<E>- Overrides:
containsin classAbstractCollection<E>
-
listIterator
public ListIterator<E> listIterator(int index)
- Specified by:
listIteratorin interfaceList<E>- Overrides:
listIteratorin classAbstractList<E>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceList<E>- Overrides:
clearin classAbstractList<E>
-
-