import java.util.*; public class StudentSortedSet { public static void main(String[] args) { SortedSet students = new TreeSet(); students.add(new Student("John", "Smith")); students.add(new Student("Stanley", "Peters")); students.add(new Student("Edgar", "Bloch")); students.add(new Student("Suzan", "Miles")); students.add(new Student("Mary", "Poppins")); students.add(new Student("Tom", "Rich")); for(Student n: students) System.out.println(n); System.out.println("\n***Print headset***"); SortedSet subStudents = students.headSet(new Student("Mary", "Poppins")); for(Student s: subStudents) System.out.println(s); System.out.println("\n***Print tailset***"); subStudents = students.tailSet(new Student("Mary", "Poppins")); for(Student s: subStudents) System.out.println(s); } }