RealmMap

interface RealmMap<K, V> : MutableMap<K, V>

A RealmMap is used to map keys to values. RealmMaps cannot contain duplicate keys and each key can be mapped to at most one value. RealmMaps cannot have null keys but can have null values.

Similarly to RealmList and RealmSet, RealmDictionary properties cannot be nullable.

Most importantly, RealmMaps can only have String keys and should not be used to define properties in RealmObjects. If you need to use a Map<String, V> or a dictionary-type data structure for your model you should use RealmDictionary.

Parameters

K

the type of the keys stored in this map

V

the type of the values stored in this map

Functions

asFlow
Link copied to clipboard
abstract fun asFlow(): Flow<MapChange<K, V>>
Observes changes to the RealmMap.
clear
Link copied to clipboard
abstract fun clear()
containsKey
Link copied to clipboard
abstract fun containsKey(key: K): Boolean
containsValue
Link copied to clipboard
abstract fun containsValue(value: V): Boolean
get
Link copied to clipboard
abstract operator fun get(key: K): V?
isEmpty
Link copied to clipboard
abstract fun isEmpty(): Boolean
put
Link copied to clipboard
abstract fun put(key: K, value: V): V?
putAll
Link copied to clipboard
abstract fun putAll(from: Map<out K, V>)
remove
Link copied to clipboard
abstract fun remove(key: K): V?

Properties

entries
Link copied to clipboard
abstract override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
keys
Link copied to clipboard
abstract override val keys: MutableSet<K>
size
Link copied to clipboard
abstract val size: Int
values
Link copied to clipboard
abstract override val values: MutableCollection<V>

Inheritors

RealmDictionary
Link copied to clipboard