greenrobot / ObjectBoxRxJava

Optional RxJava 2 APIs for ObjectBox
Apache License 2.0
71 stars 8 forks source link

Subcribe on query with single value. #4

Closed RomanTcv closed 6 years ago

RomanTcv commented 6 years ago

I have a query value.

Query<Student> query = mStudentBox.query().contains(Student_.name, searchText).build();
query.subscribe().on(AndroidScheduler.mainThread()).observer(new DataObserver<List<Student>>() {
            @Override
            public void onData(List<Student> data) {
                ......
            }
        });

But i don't need List, i need a single value, like this:

Query<Student> query = mStudentBox.query().contains(Student_.name, searchText).build();
query.findFirst();

How i can do this ? How i can subscribe on this query ? I didn't find the solution. Thank you for your time