Realm-java: Support for Set and Map in model classes

Created on 17 Jan 2015  路  40Comments  路  Source: realm/realm-java

Some model classes uses Set and Map. We should look into providing both options:

public class ExampleModel extends RealmObject {
  RealmSet<anyRealmDataType> realmSet;
  RealmMap<anyRealmDataType, anyRealmDataType> realmMap;
}
Design-Required T-Feature

Most helpful comment

+10000000

All 40 comments

Also worth looking into people using their own collection types: https://twitter.com/tsmith/status/689568188514762754

Supporting the generic Collection interface / types would probably not be possible at all since we would have no way of redirecting access to the native code, but creating AbstractSet, AbstractMap and the likes might be possible although it uncertain if the effort is worth it.

For those looking for a workaround until this is solves, see here: http://stackoverflow.com/questions/35311755/realm-orm-how-to-deal-with-maps

+1 Set/Map support is crucial in a modern DBMS

+1

+1

+1

+1

+1

You guys really do need RealmSet now.

Hello, any chance of a RealmLinkedSet?

@Zhuinden Not impossible, I assume it is because you are looking for insertion order iteration?

@cmelchior yes, but without having to worry about duplication on add().

+1

+1

+10000000

+1 馃憤

+1

+1

@cmelchior interestingly, I've heard that with "stable ID support", sets would become trivial to implement in core.

However, I have this wild guess that non-sync java realm does not have stable IDs?

Hoping for this feature. Don't know why this is not already available...

+1

+1

+1

+1

+1

+1

+1

+1

+2

+9000

waiting for realm set :)

+1

+1 set (ordered!)

+1

+1

+1

+1

+1

+1

+1

Was this page helpful?
0 / 5 - 0 ratings