1 package example.cmp.map; 2 3 import java.rmi.*; 4 import javax.ejb.*; 5 6 import java.util.*; 7 8 12 public class GradeKey { 13 public Student student; 14 public Course course; 15 16 19 public GradeKey() 20 { 21 } 22 23 26 public GradeKey(Student student, Course course) 27 { 28 this.student = student; 29 this.course = course; 30 } 31 32 35 public boolean equals(Object obj) 36 { 37 if (! (obj instanceof GradeKey)) 38 return false; 39 40 GradeKey key = (GradeKey) obj; 41 42 return student.equals(key.student) && course.equals(key.course); 43 } 44 45 48 public int hashCode() 49 { 50 return 65521 * student.hashCode() + course.hashCode(); 51 } 52 } 53 | Popular Tags |