realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

Support for Set and Map in model classes

Open cmelchior opened this issue 11 years ago • 42 comments

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;
}

cmelchior avatar Jan 17 '15 13:01 cmelchior

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.

cmelchior avatar Jan 20 '16 08:01 cmelchior

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

bmunkholm avatar Feb 11 '16 09:02 bmunkholm

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

marioguerriero avatar Apr 15 '16 16:04 marioguerriero

+1

biajoeknee avatar Sep 11 '16 18:09 biajoeknee

+1

mhmtk avatar Oct 10 '16 13:10 mhmtk

+1

ishaforenko avatar Jan 26 '17 23:01 ishaforenko

+1

autovalue avatar Feb 13 '17 20:02 autovalue

+1

agrusha avatar Feb 15 '17 07:02 agrusha

You guys really do need RealmSet now.

Zhuinden avatar Feb 15 '17 08:02 Zhuinden

Hello, any chance of a RealmLinkedSet?

Zhuinden avatar Jun 01 '17 09:06 Zhuinden

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

cmelchior avatar Jun 01 '17 10:06 cmelchior

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

Zhuinden avatar Jun 01 '17 11:06 Zhuinden

+1

asiljan avatar Jun 09 '17 08:06 asiljan

+1

valentin-sobolev avatar Jun 21 '17 13:06 valentin-sobolev

+10000000

Bastosss77 avatar Jun 27 '17 08:06 Bastosss77

+1 👍

jennymolske avatar Jul 12 '17 13:07 jennymolske

+1

lauraoran avatar Aug 04 '17 08:08 lauraoran

+1

PhilTdr avatar Sep 13 '17 14:09 PhilTdr

@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?

Zhuinden avatar Oct 01 '17 18:10 Zhuinden

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

reinaldomoreira avatar Oct 09 '17 11:10 reinaldomoreira