| Author |
collections.sort compiler error?
|
maggie joseph
Ranch Hand
Joined: Dec 29, 2009
Posts: 185
|
|
|
|
 |
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
|
|
First, I searched for the problem, I didn't find. Then I looked at code and somewhere in the code, you comment your question, which is at all not attentive in any manner.
Second, if you posted the error that will yield more answer and error are sometime self explainable.
|
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14669
|
|
|
What type of objects does Collections.sort accepts ? Check the API.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Anuradha Prasanna
Ranch Hand
Joined: Mar 09, 2006
Posts: 115
|
|
hi,
java.util.Collections contains the following methods for sorting,
1)static void sort(List)
2)static void sort(List, Comparator)
from the above, we can see, the sort() method takes only argument of type List to sort. It does not sort HashSets.
|
SCJP 6.0 90%
|
 |
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
|
|
|
and if you really want your set to be sorted one, try using java.util.TreeSet ;)
|
 |
 |
|
|
subject: collections.sort compiler error?
|
|
|