Two Laptop Bag
The moose likes Java in General and the fly likes Sorting Arraylist of objects base on their integers feild Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Sorting Arraylist of objects base on their integers feild" Watch "Sorting Arraylist of objects base on their integers feild" New topic
Author

Sorting Arraylist of objects base on their integers feild

Sheila Jorge
Greenhorn

Joined: Oct 24, 2011
Posts: 16
Hi all,

I have an arraylist of objects. Any Object contain 4 fields. one of these fields is integer.I want sort these arrylist base on integer field of objects.

I use this code bud i don't know how it must be to work correctly.

Collections.sort(list, new Comparator(){
public int compare(Object o1, Object o2) {
ob obs1 = (ob) o1;
ob obs2 = (ob) o2;
return ............);
}
});

please help mee
Manyyy thankssssssss
Sheila Jorge
Greenhorn

Joined: Oct 24, 2011
Posts: 16
I find the answer of my post . I want deleted this post but i couldn't find delete button.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Sorting Arraylist of objects base on their integers feild
 
Similar Threads
Interface question
interface
Marcus Green exam 2 Q.50
implementing and extending
where is the Object o1 come from?