RealmSet

interface RealmSet<E> : MutableSet<E> , Deleteable

RealmSet is a collection that contains no duplicate elements.

Similarly to RealmLists, a RealmSet can operate in managed and unmanaged modes. In managed mode a RealmSet persists all its contents inside a realm whereas in unmanaged mode it functions like a MutableSet.

Managed RealmSets can only be created by Realm and will automatically update their content whenever the underlying Realm is updated. Managed RealmSets can only be accessed using the getter that points to a RealmSet field of a RealmObject.

Parameters

E

the type of elements contained in the RealmSet.

Functions

add
Link copied to clipboard
abstract override fun add(element: E): Boolean
addAll
Link copied to clipboard
abstract override fun addAll(elements: Collection<E>): Boolean
asFlow
Link copied to clipboard
abstract fun asFlow(): Flow<SetChange<E>>
Observes changes to the RealmSet.
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
isEmpty
Link copied to clipboard
abstract override fun isEmpty(): Boolean
iterator
Link copied to clipboard
abstract operator override fun iterator(): MutableIterator<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
retainAll
Link copied to clipboard
abstract override fun retainAll(elements: Collection<E>): Boolean

Properties

size
Link copied to clipboard
abstract override val size: Int

Extensions

copyFromRealm
Link copied to clipboard
inline fun <T : RealmObject> RealmSet<T>.copyFromRealm(depth: UInt = UInt.MAX_VALUE): Set<T>
Makes an unmanaged in-memory copy of the elements in a managed RealmSet.
query
Link copied to clipboard
fun <T : BaseRealmObject> RealmSet<T>.query(filter: String = TRUE_PREDICATE, vararg arguments: Any?): RealmQuery<T>
Query the objects in a set by filter and arguments.