This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Sorting two calendar years" Watch "Sorting two calendar years" New topic

Sorting two calendar years

Amrita Datta

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

Joined: Oct 27, 2005
Posts: 19656

What is in the list?

How To Ask Questions How To Answer Questions
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30138

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

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
subject: Sorting two calendar years
Similar Threads
Suggestions for date validation
Year in Java
xml calendar
exam second chances??
New Programmer