Non Java geeks may want to ignore this entirely, or skip to the summary.
I've just spent about three hours trying to debug the following error message:
Collections.sort(objects);
The method sort(List) in the type Collections is not applicable for the arguments (Collection)
I've used Collections.sort() before, and it just worked out of the box, so this was particularly frustrating. I put it down to the fact that I hadn't heard of generics when I'd used it before, whereas now I was using them extensively, so obviously something had changed with the introduction of generics. Spent ages reading about generics, type arguments, type inference, the Comparable interface ... and no matter how I tried poking at it, it kept giving me the same infuriating error message.
I just realised that it's nothing to do with generics ... it's the fact that I'm passing in a Collection instead of a List.
Summary
I need to read error messages more closely. That's three hours of my life I won't get back. *bangs head repeatedly off desk*
[edit] Admittedly, about two of those three hours were actually spent just reading around the
Canadian Mind Products site ... but that was only because I was desperately avoiding the problem...