How sort by date in RealmResults

Viewed 518

There are fields for storing the date. Some fields have a date, and some fields are empty (without a date). I need to sort in such a way that at the beginning of the list there are fields with a date in ascending order. And at the end of the list, there were fields without a date.

A normal sort places the fields without a date at the top of the list.

RealmResults<Task> results = mRealm.where(Task.class).findAll()
                .sort(Task.TARGET_DATE, Sort.ASCENDING);

How can I arrange sorting so that the fields without a date are at the end of the list?

1 Answers
Related