R
Roedy Green
I write lines like this:
Arrays.sort( anArray );
Collection.sort( anArrayList );
Collection.sort( anArrayList, new DescendingNumerically() );
sometimes the compiler likes them and other times it does not. The
mystery is solved. Though it complains there, the problem is miles
away, and not at the declarations either:
ArrayList anArraylist = new ArrayList<Entry>(200);
The problem is in the declaration of Entry.
It must say implements Comparable<Entry> not just implements
Comparable. You'd think somehow the compiler would know it had to be
comparing Entry objects but it doesn't.
In a similar way Eclipse often complains that some symbol is undefined
when it really means the import statement for type corresponding to
that symbol is missing.
--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
Arrays.sort( anArray );
Collection.sort( anArrayList );
Collection.sort( anArrayList, new DescendingNumerically() );
sometimes the compiler likes them and other times it does not. The
mystery is solved. Though it complains there, the problem is miles
away, and not at the declarations either:
ArrayList anArraylist = new ArrayList<Entry>(200);
The problem is in the declaration of Entry.
It must say implements Comparable<Entry> not just implements
Comparable. You'd think somehow the compiler would know it had to be
comparing Entry objects but it doesn't.
In a similar way Eclipse often complains that some symbol is undefined
when it really means the import statement for type corresponding to
that symbol is missing.
--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes