record Student(String name, int grade, int score) {}

void main() {
    ArrayList<Student> students = new ArrayList<>(List.of(
            new Student("Ada", 9, 88),
            new Student("Grace", 10, 92),
            new Student("Alan", 9, 45),
            new Student("Katherine", 11, 95)));

    ArrayList<Student> byScore = new ArrayList<>(students);
    byScore.sort(Comparator.comparing((Student s) -> s.score())
            .reversed());

    for (Student student : byScore) {
        IO.println(String.format("%-12s%d", student.name(), student.score()));
    }
}

// From Groundwork, chapter 10 (ch10-records), box 10.
// This example is from Groundwork, licensed CC BY-NC-SA 4.0.
// Run with: java ch10_10.java
