RealmDictionary - Java SDK
On this page
New in version 10.6.0.
You can use the RealmDictionary data type to manage a collection of
String keys paired with values.
Map interface, so it works just like the built-in
HashMap class, except managed
RealmDictionary instances persist
their contents to a realm.
RealmDictionary instances that
contain Realm objects store references to those objects.
When you delete a Realm object from a realm, any
references to that object in a
To create a field of type
RealmDictionary, define an object property
T defines the values you would
like to store in your
instances can only use keys of type
The following table shows which methods you can use to complete common
collection tasks with
Add an object to a
put() (or the
Add multiple objects to a
Check if the dictionary contains an specific key
Check if the dictionary contains a specific value
To subscribe to changes to a
RealmDictionary, pass a
implementation to the RealmSet.addChangeListener method.
MapChangeListener implementation must define an
onChange() method, which accepts a reference to the changed
and a set of changes as parameters. You can access the keys
added to the dictionary as well as the keys removed from the dictionary