Date Sorting - Latest to Oldest

Posted by Erika Szabo on Stack Overflow See other posts from Stack Overflow or by Erika Szabo
Published on 2010-04-09T10:17:07Z Indexed on 2010/04/09 10:23 UTC
Read the original article Hit count: 347

Filed under:
|
|
Collections.sort(someList, new Comparator<SomeObject>() {
            public int compare(final SomeObject object1, final SomeObject object2) {
                return (object1.getSomeDate()).compareTo(object2.getSomeDate()); 
            }}
        );

Would it give me the objects with latest dates meaning the list will contain the set of objects with latest date to oldest date?

© Stack Overflow or respective owner

Related posts about java

Related posts about collections