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.

Properties

Link copied to clipboard
abstract override val size: Int

Functions

Link copied to clipboard
abstract override fun add(element: E): Boolean
Link copied to clipboard
abstract override fun addAll(elements: Collection<E>): Boolean
Link copied to clipboard
abstract fun asFlow(keyPaths: List<String>? = null): Flow<SetChange<E>>

Observes changes to the RealmSet. The Flow will emit InitialSet once subscribed, and then UpdatedSet on every change to the set. The flow will continue running indefinitely until canceled or until the parent object is deleted.

Link copied to clipboard
abstract override fun clear()
Link copied to clipboard
abstract operator override fun contains(element: E): Boolean
Link copied to clipboard
abstract override fun containsAll(elements: Collection<E>): Boolean
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. This is a deep copy that will copy all referenced objects.

Link copied to clipboard
abstract override fun isEmpty(): Boolean
Link copied to clipboard
abstract operator override fun iterator(): MutableIterator<E>
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.

Link copied to clipboard
abstract override fun remove(element: E): Boolean
Link copied to clipboard
abstract override fun removeAll(elements: Collection<E>): Boolean
Link copied to clipboard
abstract override fun retainAll(elements: Collection<E>): Boolean
Link copied to clipboard

Instantiates an unmanaged RealmDictionary containing all the elements of this iterable of Pairs of Strings and Ts.

Instantiates an unmanaged RealmDictionary containing all the elements of the receiver RealmDictionaryEntrySet.

Link copied to clipboard

Instantiates an unmanaged RealmList containing all the elements of this iterable.

Link copied to clipboard

Instantiates an unmanaged RealmSet containing all the elements of this iterable.