Thread: List of lists

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    6
    Rep Power
    0

    List of lists


    I was wondering if anyone had a good implementation of a List of list. The reason is to create rows and columns sort of like a database or spreadsheet format. I would like to insert data into the list and print it in the format of
    Column Column Column Column
    Row 1 This That 3123

    I want to use java and the linked list is just a starting point(open to suggestions).
    Thanks for help in advance
  2. #2
  3. Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    May 2004
    Location
    Superior, CO, USA
    Posts
    2,418
    Rep Power
    1713
    What is wrong with something like:

    java Code:
    ArrayList<ArrayList<String>> myListofLists = new ArrayList<ArrayList<String>>();
     
    // remember to allocate each new item with an ArrayList<String>
    ArrayList<String> someList = new ArrayList<String>();
    someList.add( "a string" );
    myListofLists.add( someList );
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    6
    Rep Power
    0
    That's perfect thank you.

    Originally Posted by stdunbar
    What is wrong with something like:

    java Code:
    ArrayList<ArrayList<String>> myListofLists = new ArrayList<ArrayList<String>>();
     
    // remember to allocate each new item with an ArrayList<String>
    ArrayList<String> someList = new ArrayList<String>();
    someList.add( "a string" );
    myListofLists.add( someList );

IMN logo majestic logo threadwatch logo seochat tools logo