Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes Sorting two calendar years Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Sorting two calendar years" Watch "Sorting two calendar years" New topic
Author

Sorting two calendar years

Amrita Datta
Greenhorn

Joined: Mar 13, 2009
Posts: 3
I need to sort an array list based on two different calendar years.
The information that we get in the current calendar year shoud be displayed first followed by the previous calendar year.

Am unable to sort the information based on the 2 calendar years.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20080
    
  30

What is in the list?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32501
    
214

One place to start is the Comparator class. It lets you define a specific sort order as being different from the default.


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
 
Have you checked out Aspose?
 
subject: Sorting two calendar years
 
It's not a secret anymore!