Jon
Jesper de Jong wrote:You get those warnings because you are using a raw HashMap, so the compiler cannot check if your code is typesafe. Use generics to enable the compiler to check this:
Likewise for the Collection (line 33) and the Iterator (line 36).
Jon
Jesper de Jong wrote:What do you mean by "read methods from the BuggyEmployee method"? When you iterate through the values of the map, you iterate over BuggyEmployee objects, and ofcourse you can call any methods that are defined in class BuggyEmployee on those objects.
Jon
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Spoor wrote:Your Map has the right generic types. That means that, if you are able to iterate over it, you can access the elements without needing a cast.
Check out the Javadoc page of java.util.Map. Find all methods that return something you can iterate over: java.util.Collection, java.util.List, java.util.Set, java.util.Queue, java.util.Deque, etc. Post the results here, and tell us for each of them why that one is good or not.
Jon
Campbell Ritchie wrote:A Map is like an address book. You "put" by writing the name and address in it (two things), then you "get " by looking up the name (one thing) and finding the address. So you need to check how many arguments you ought to pass to the get method.
Jon
Jon Camilleri wrote:By the way what its.hasNext() - see line 41 below; it does not seem to be equal to the hashCode()
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Spoor wrote:
Jon Camilleri wrote:By the way what its.hasNext() - see line 41 below; it does not seem to be equal to the hashCode()
I know a great site for you: http://download.oracle.com/javase/6/docs/api/. Learn to use it, to find classes, methods, etc. Then lookup what these methods will do. I'll help you out to narrow down your search a bit: http://download.oracle.com/javase/6/docs/api/index-files/index-8.html. Scroll down until you find a method that looks like that one, belonging to the right class.
Jon