How to optimize realm.allobjects(class) in Android -


i want use realm replace sqlite in android store list of classes, code simple below.

public class myrealmobject extends realmobject {      public string getfield() {         return field;     }     public void setfield(string field) {         this.field = field;     }      private string field;     ... }   list<myobject> myobjects = new arraylist();  realm realm = realm.getinstance(this); for(myrealmobject realm : realm.allobjects(myrealmobject.class)) {   myobjects.add(new myobject(realm)); }  realm.close(); return myobjects; 

however, performance slower simple sqllite table on tested device, using wrong way? there optimization tricks?

why want wrap realmobjects in myobject class?. copying entire result set means loose benefit of using realm, namely doesn't copy data unless needed to.

realmresults implements list interface should able use 2 interchangeably.

list<myrealmobject> myobjects;  realm realm = realm.getinstance(this); myobjects = realm.allobjects(myrealmobject.class(); return myobjects; 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -