How to allow duplicate keys in a HashMap or TreeMap?
<p>I have been given an assignment where I need to use either a HashMap or TreeMap to hold a list of students and their grade. I assume that they key would be the name and the value would be the student's grade. I have been instructed to allow for students with the same name.</p>

<p>Because neither HashMap or TreeMap allow for duplicate keys I can't have the name be the key, correct?</p>

<p>Is there a simple way to allow for duplicate keys? How would a TreeMap sort duplicate keys?</p>

<p>I also need to be able to sort by name so I would prefer to use TreeMap.</p>