Search:

Type: Posts; User: J05HYYY

Search: Search took 0.12 seconds.

  1. Replies
    14
    Views
    9,423

    Re: How to use this 2d ArrayList class?

    No, you didn't miss something...

    ArrayList<String> valuesDuo = new ArrayList<String>(values);

    Means, I think that it creates a new instance so it doesn't change the original. Anywhoo I tested...
  2. Replies
    14
    Views
    9,423

    Re: How to use this 2d ArrayList class?

    Okay, I have tested the code I gave earlier and found that it works ie. it doesn't change the original ArrayList.


    ArrayList<Integer> vlinefreq = new ArrayList<Integer>();
    ArrayList<Integer>...
  3. Replies
    14
    Views
    9,423

    Re: How to use this 2d ArrayList class?

    Interesting. Maybe the code I just gave didn't work. I have just tried something only slightly more complex and it didn't work:


    ArrayList<Integer> vtemplinenum = new ArrayList<Integer>();...
  4. Replies
    14
    Views
    9,423

    Re: How to use this 2d ArrayList class?

    Yeah, in that case I need a deep copy.

    Meh, no need to use clone but still a pain to cycle through every element.



    vlinefreq.clear();
    int x;
    for (x=0; x < vfrequency.get(s).size(); x++)
    {
  5. Replies
    14
    Views
    9,423

    Re: How to use this 2d ArrayList class?

    One more last thing :P ... how do I copy an ArrayList? I tried this:


    vlinefreq = vfrequency.get(s);

    but it doesn't seem to work as I imagined it to.
  6. Replies
    14
    Views
    9,423

    Re: How to use this 2d ArrayList class?

    Cheers - answered my questions exactly.
  7. Replies
    14
    Views
    9,423

    Re: How to use this 2d ArrayList class?

    Thank you. This is what I needed. :)

    ... one last thing, how would I go about reassigning a new value to an existing element?
  8. Replies
    14
    Views
    9,423

    How to use this 2d ArrayList class?

    Hello,

    I am new to java, these forums and know very little about object orientated programming.
    I am trying to convert a C++ program to java which uses 2 dimentional vectors.
    Searching google I...
Results 1 to 8 of 8