// Java
List <Student> students = database.query <Student> (
   new Predicate <Student> () {
     public boolean match(Student student){
       return student.getAge() < 20 && student.getName().contains("f"); 
    }
});
Collections.sort(students, new Comparator <Student>(){
  public int compare(Student student1, Student student2) {
    return student1.getAge() - student2.getAge();
  }
});

Example 10: Defining the sort order of returned objects.

Back to Article