It is not that hard. If you compile it then you'll get this message:
wouter@wouter-laptop:~/temp$ javac TurtleTest.java
TurtleTest.java:39: cannot find symbol
symbol : class Entry
location: class TurtleTest
for (Entry<Turtle, Turtle> t:lh.entrySet())
^
1 error
Saying that it cannot find that class. So just import it
But then it still does not want you want it to do because the hashCode method has not been implemented (A Map uses hashCode and equals to determine if objects are equal, not the comparable interface).
So implement the hashCode and equals methods properly. Total code:
And then the output is 3 which is what we wanted/expected.