hw3, #2

2 views
Skip to first unread message

Christopher G Kelly 5

unread,
Feb 22, 2012, 1:24:25 PM2/22/12
to cs31...@googlegroups.com
The question reads: "Suppose you want to use a HashSet for element objects of a type BigElement implemented by some code you’re not supposed to change, yet doesn’t have a hashCode() implementation. Suppose it has an equals method based on its name field, like SimpleStudent, Fig. 6.35, and getters for all fields. What can you do? (Don’t forget to add “private” to SimpleStudent’s fields.) "

I'm confused, are we working with a class called BigElement or the Simple Student class? From what I've seen in the book, SimpleStudent already has a hashCode() method based upon the name variable, so I'm a bit uncertain as to how to approach this one.

Thanks,
Chris

Betty O'Neil

unread,
Feb 22, 2012, 1:28:54 PM2/22/12
to cs31...@googlegroups.com
SimpleStudent is only used here as an illustration of the equals method
being used by BigElement, the class that you are working with in
the problem.
Reply all
Reply to author
Forward
0 new messages