package queueInterface; import java.util.Objects; public class Student implements Comparable { private String name; private int course; public Student(String name, int course) { this.name = name; this.course = course; } @Override public int compareTo(Student o) { return (this.course-o.course); } @Override public String toString() { return "Student{" + "name='" + name + '\'' + ", course=" + course + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Student student = (Student) o; return course == student.course; } @Override public int hashCode() { return Objects.hash(course); } }