public class Dog extends RealmObject {
public String name;
public int age;
}
Dog dog = new Dog();
dog.name = "Rex";
dog.age = 1;
Realm realm = Realm.getDefaultInstance();
realm.executeTransaction(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
realm.copyToRealmOrUpdate(dog);
}
});
RealmResults<Dog> pups = realm.where(Dog.class)
.lessThan("age", 2)
.findAll();