Sorting list objects in java

static class MyClassComparator implements Comparator<MyClass>
 {
     public int compare(MyClass c1, MyClass c2)
     {
         return c1.getXXXXX().compareTo(c2.getXXXXX());
     }
 }
And then use Collections.sort(list,new MyClassComparator());

No comments:

Post a Comment

Genuine websites to earn money.

If you are interested in PTC sites then this article is for you. I have personally tried many of the sites and found that the best thing ...