Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Help with sorting Calendar objects!

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Thanked 0 Times in 0 Posts

    Default Help with sorting Calendar objects!

    So here is what i have in hand:

    An Object: Booking(Calendar c1, Calendar c2, Object o1, Object o2)
    An ArrayList "bookings"

    I have to sort the bookings according to c1 times of them and print them.

    Now I would love to use this Collections.sort() thing, but i guess its not possible with this list.

    Do I have to make a sorting method manually ? Any quick ideas ?

  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Thanked 833 Times in 772 Posts
    Blog Entries

    Default Re: Help with sorting Calendar objects!

    Why not? Just write a class that implements Comparable, implemented as you want to sort. See Object Ordering

Similar Threads

  1. Calendar date
    By joshft91 in forum Object Oriented Programming
    Replies: 11
    Last Post: November 6th, 2010, 02:47 AM
  2. [SOLVED] Calendar Issue
    By aussiemcgr in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 11th, 2010, 01:19 PM
  3. Calendar help
    By moonieass13 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: October 31st, 2009, 12:43 AM
  4. calendar
    By subhvi in forum AWT / Java Swing
    Replies: 2
    Last Post: September 29th, 2009, 11:02 PM
  5. which calendar to use?
    By rptech in forum AWT / Java Swing
    Replies: 6
    Last Post: August 30th, 2009, 03:18 PM