Results 1 to 3 of 3
  1. #1
    triratnasari is offline Member
    Join Date
    Jun 2013
    Posts
    1
    Rep Power
    0

    Post Array in Linked List

    Please help. I got an assignment from my lecturer to make a program out of linked list, array and stack. So, I decided to make hotel management program where I can stock customer data such as name, address, etc. and view them later all at once as our data. The thing is I got confused on how inserting array as an object data in linked list. Would any of you give me an advice?

  2. #2
    kalata is offline Member
    Join Date
    Aug 2011
    Location
    Bulgaria
    Posts
    29
    Rep Power
    0

    Default Re: Array in Linked List

    Hi, I hope this snippet helps:
    Java Code:
    LinkedList<int[]> ll = new LinkedList<int[]>();
    int[] arr1 = {0, 2, 1};
    ll.add(arr1); // add at the end of the list
    int[] arr2 = {3, 4, 5};
    ll.add(0, arr2); // add at given index
    BR,
    Kalin
    "One of the greatest ways to learn something is trying to teach it to someone else."

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

    Default Re: Array in Linked List

    Quote Originally Posted by triratnasari View Post
    Please help. I got an assignment from my lecturer to make a program out of linked list, array and stack. So, I decided to make hotel management program where I can stock customer data such as name, address, etc. and view them later all at once as our data. The thing is I got confused on how inserting array as an object data in linked list. Would any of you give me an advice?
    I suspect your design lacks a proper object model; what's the reason for a list of arrays? That is so Fortranesque ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Linked list or array
    By vx117 in forum New To Java
    Replies: 11
    Last Post: 02-11-2013, 01:36 PM
  2. Replies: 0
    Last Post: 09-25-2012, 04:07 AM
  3. Linked List, Array List time complexity
    By Rick99771977 in forum New To Java
    Replies: 4
    Last Post: 08-18-2011, 05:37 AM
  4. Array to Linked List
    By Aiquoc in forum New To Java
    Replies: 2
    Last Post: 04-23-2011, 01:32 PM
  5. linked list or array?
    By sick_peng in forum New To Java
    Replies: 6
    Last Post: 04-15-2009, 07:33 PM

Posting Permissions

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