RealmList

interface RealmList<E> : MutableList<E>

RealmList is used to model one-to-many relationships in a RealmObject.

A RealmList has two modes: managed and unmanaged. In managed mode all objects are persisted inside a Realm whereas in unmanaged mode it works as a normal MutableList.

Only Realm can create managed RealmLists. Managed RealmLists will automatically update their content whenever the underlying Realm is updated. Said content can only be accessed using the getter of a RealmObject.

Unmanaged RealmLists can be created by the user and can contain both managed and unmanaged RealmObjects. This is useful when dealing with JSON deserializers like Gson or other frameworks that inject values into a class. Unmanaged elements in a list can be added to a Realm using the MutableRealm.copyToRealm method.

Functions

add
Link copied to clipboard
abstract override fun add(element: E): Boolean
abstract fun add(index: Int, element: E)
addAll
Link copied to clipboard
abstract override fun addAll(elements: Collection<E>): Boolean
abstract fun addAll(index: Int, elements: Collection<E>): Boolean
clear
Link copied to clipboard
abstract override fun clear()
contains
Link copied to clipboard
abstract operator override fun contains(element: E): Boolean
containsAll
Link copied to clipboard
abstract override fun containsAll(elements: Collection<E>): Boolean
get
Link copied to clipboard
abstract operator fun get(index: Int): E
indexOf
Link copied to clipboard
abstract fun indexOf(element: E): Int
isEmpty
Link copied to clipboard
abstract override fun isEmpty(): Boolean
iterator
Link copied to clipboard
abstract operator override fun iterator(): Iterator<E>
lastIndexOf
Link copied to clipboard
abstract fun lastIndexOf(element: E): Int
listIterator
Link copied to clipboard
abstract override fun listIterator(): MutableListIterator<E>
abstract override fun listIterator(index: Int): MutableListIterator<E>
observe
Link copied to clipboard
abstract fun observe(): Flow<RealmList<E>>
remove
Link copied to clipboard
abstract override fun remove(element: E): Boolean
removeAll
Link copied to clipboard
abstract override fun removeAll(elements: Collection<E>): Boolean
removeAt
Link copied to clipboard
abstract fun removeAt(index: Int): E
retainAll
Link copied to clipboard
abstract override fun retainAll(elements: Collection<E>): Boolean
set
Link copied to clipboard
abstract operator fun set(index: Int, element: E): E
subList
Link copied to clipboard
abstract override fun subList(fromIndex: Int, toIndex: Int): MutableList<E>

Properties

size
Link copied to clipboard
abstract override val size: Int