aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes collections.sort compiler error? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "collections.sort compiler error?" Watch "collections.sort compiler error?" New topic
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
    
    1

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
    
  11

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
    
    1

and if you really want your set to be sorted one, try using java.util.TreeSet ;)
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: collections.sort compiler error?
 
Similar Threads
Regarding Hashcode
What's wrong with this code? Why I am able to add duplicates with this code.
generics and collections: Q11, page 642 - is my understanding correct ?
how will i get my values from collection?
hashcodes