Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Converting a Arraylist to a 2-D array

    I have an arraylist as below:

    Code:
    ArrayList listArray = new ArrayList(); 
    listArray.add("Germany");
     listArray.add("Holland");
     listArray.add("Sweden"); 
    listArray.add("India");
    Now i want to convert this list or add the above elements of the list to an two-dimensional array as below:

    (Germany,Holland)
    (Sweden,India)

    How can i add the list items to a 2-D array in above manner.

    The toArray method returns single dimension array.

    Thanks in advance.

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    theres no predefined API call to do this...so, u'll have to write ur own
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow


  •  

    Posting Permissions

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