Concept

How can a Comparator sort Student objects by GPA?

ComputerScienceOne / Searching

"Comparator<Student> byGpa = new Comparator<Student>() {\n\n@Override\n\npublic int compare(Student a, Student b) {\n\nreturn b.getGpa().compareTo(a.getGpa());\n\n}\n\n};\n\nWe now turn our attention to the search and sorting methods provided by the JDK. Most of these methods are generic implementations that either sort an array or collection using the natural ordering or take a parameterized Comparator<T> to determine the ordering."

Related Ideas

How can a Comparator sort Student objects by GPA? | ComputerScienceOne | Bifalgorithm | Bifalgorithm