Now i have a loop where i want to assign (for example), 8 periods or something to each array list as separate elements. I don't want to do this same code and repeat it 8 times for each list, like this:
Now i have a loop where i want to assign (for example), 8 periods or something to each array list as separate elements. I don't want to do this same code and repeat it 8 times for each list, like this:
James, out of curiosity, isn't that the same thing as what Vernon suggested?
Very similar, except that I used an ArrayList where Vernon used an array. I have a strong prejudice in favour of ArrayLists or Vectors as opposed to arrays - saves all that housekeeping for nextEmptyElement and maxSizeExceeded, and Vectors are thread safe. I always suspect that any use of an array in Java should really be a Vector if it's variable sized, or an enum if it's fixed.
But that's just my opinion.
Oh, I was referring to where he said "Or make row an ArrayList of ArrayLists." I thought maybe there was some difference in syntax between how you did it and he did it or something. Nevermind.
Oh, I was referring to where he said "Or make row an ArrayList of ArrayLists." I thought maybe there was some difference in syntax between how you did it and he did it or something. Nevermind.
No difference. James and I were thinking the same thing here.
Oh, I was referring to where he said "Or make row an ArrayList of ArrayLists." I thought maybe there was some difference in syntax between how you did it and he did it or something. Nevermind.
He developed the code for the array version in some detail, so I just filled in a little more detail on the version that he mentioned with his "or...". I've found that many people don't realise that you can specify nested generics, let alone how to do it.
I think we're all in complete agreement!
this absolutely doesn't solve the issue if you for example have set of jTextArea1 jTextArea2 and so on.... you can't just conjure it into array from a thin air....
some variables can't be array'd not like in bash..... awww I miss bash so much.
1. This is a long dead thread
2. You can put anything in a Java array. If you have a Set of <anything> you can get it as an array with its the toArray() method. Please don't confuse beginners here with incorrect statements.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.