Package io.objectbox.query
Class LazyList<E>
java.lang.Object
io.objectbox.query.LazyList<E>
- Type Parameters:
E- Object type (entity).
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>
A thread-safe, unmodifiable
List that gets Objects from their Box not until they are accessed.
Internally the list is backed by an array of Object IDs.
If the list is set to not cache retrieved Objects, each operation will get the latest version of an Object
from its Box. However, in this mode only a limited set of List operations,
like get or iterator are supported.
If the list is set to cache retrieved Objects, operations will return a previously fetched version of an Object,
which might not equal the latest version in its Box. However, in this mode almost all List
operations are supported. Note that operations that require the whole list, like contains, will fetch all
Objects in this list from the Box at once.
Note: as Objects are fetched on demand, this list returns a null Object if the Object was removed from its Box after this list was created.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int arg0, Collection<? extends E> arg1) booleanaddAll(Collection<? extends E> arg0) protected voidvoidclear()booleanbooleancontainsAll(Collection<?> collection) get(int location) Gets and returns the Object at the specified position in this list from its Box.intintbooleanisEmpty()booleaniterator()intlastIndexOf(Object object) listIterator(int location) voidLoads the remaining entities (if any) that were not loaded before.peek(int location) Like get but does not load the entity if it was not loaded before.remove(int location) booleanbooleanremoveAll(Collection<?> arg0) booleanretainAll(Collection<?> arg0) intsize()subList(int start, int end) Object[]toArray()<T> T[]toArray(T[] array) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
equals, hashCode, replaceAll, sort, spliterator
-
Method Details
-
loadRemaining
public void loadRemaining()Loads the remaining entities (if any) that were not loaded before. Applies to cached lazy lists only. -
checkCached
protected void checkCached() -
peek
Like get but does not load the entity if it was not loaded before. -
getLoadedCount
public int getLoadedCount() -
isLoadedCompletely
public boolean isLoadedCompletely() -
add
-
add
-
addAll
-
addAll
-
clear
public void clear() -
contains
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>
-
get
Gets and returns the Object at the specified position in this list from its Box. Returns null if the Object was removed from its Box. If this list is caching retrieved Objects, returns the previously fetched version. -
indexOf
-
isEmpty
public boolean isEmpty() -
iterator
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
remove
-
remove
-
removeAll
-
retainAll
-
set
-
size
public int size() -
subList
-
toArray
-
toArray
public <T> T[] toArray(T[] array)
-