3 Replies Latest reply: Jun 30, 2007 3:00 PM by 807605 RSS

    getting an element in a linkedlist which is in a linkedlist

    807605
      hi,
      I need to make up a data structure such that it has 2 data elements, first one is a unique ID seconds data element is a set structure.

      What I need to do is first look up @ the ID to see if any matching entries are found, if so then the data is added to the 2nd set of elements. I need to use a set structure for the 2nd element coz I dont need any duplicates for one particular ID.

      How do I do this.

      If you guys want more details plz tell :)

      Cheers.
        • 1. Re: getting an element in a linkedlist which is in a linkedlist
          807605
          oh the link list problem is,
              public static void main(String[] args) {
                  LinkedList ld1 =  new LinkedList();
                  LinkedList ld2 =  new LinkedList();
                  
                  for (int j =0;j<10;j++){
                      
                  for(int i=0;i<100;i++){
                  ld1.add(i);
                  }
                  
                  ld2.add(ld1);
                  }
          Now assume that the ld1 no longer exsists & everything happend in the for loop is in the ld2 linked list.
          What I need to know is how do I access an element in ld1 using ld2

          for an example say I need to get the 2 in the ld2 & 3rd in ld1
          Hope its clear.

          Cheers
          • 2. Re: getting an element in a linkedlist which is in a linkedlist
            796440
            I really can't understand what you're asking.
            • 3. Re: getting an element in a linkedlist which is in a linkedlist
              807605
              sorry,
              I've messed it up.
              These are 2 different questions. I've mistakenly posted it in the same topic :( :( my bad :D

              about the linked list problem ... ld2 is the one which keeps linked lists of ld1
              so say for example 2nd element in ld2 is another linked list in ld1. right? So what I want is do operations on this particular linked list which is the 2nd element of ld2. is it clear :)