Results 1 to 3 of 3
  1. #1
    Problemer is offline Member
    Join Date
    Sep 2012
    Posts
    11
    Rep Power
    0

    Default Sorting ArrayList consisting of String Arrays.

    Hello ,


    I have an ArrayList filled with String Arrays, Example : "ArrayList(0-7)[0-7]". There are 8 Different String Arrays in the ArrayList and every String Array Consist of "8 blocks" , index number 4 in every String Array contains a name.

    I Want these sorted alphabetically , please give me an hint on how to proceed , or if you need more info to be able to help me i will explain more.

    Best Regards
    Problemer

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,436
    Blog Entries
    7
    Rep Power
    20

    Default Re: Sorting ArrayList consisting of String Arrays.

    Read all about it in the API documentation of the Comparator interface; your implementation should compare two String arrays and the Collections.sort( ... ) method does the hard work.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Problemer is offline Member
    Join Date
    Sep 2012
    Posts
    11
    Rep Power
    0

    Default Re: Sorting ArrayList consisting of String Arrays.

    Done , Used CompareTo , what was not clear to me even if i have done bubble-sorting exercises was that i needed to add a couple of for loops...anyway thats how i did it. Task is finished.

Similar Threads

  1. Adding a Value to an Arraylist of String arrays.
    By Problemer in forum New To Java
    Replies: 5
    Last Post: 11-01-2012, 02:50 PM
  2. Replies: 1
    Last Post: 03-06-2012, 12:21 AM
  3. How do you use an arraylist of string arrays
    By uhertz in forum New To Java
    Replies: 1
    Last Post: 01-16-2012, 09:38 AM
  4. Scanner, while loop and sorting arrays/string?
    By RSYR in forum New To Java
    Replies: 10
    Last Post: 04-20-2011, 06:13 PM
  5. Replies: 8
    Last Post: 10-08-2010, 07:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •