• Post Reply Bookmark Topic Watch Topic
  • New Topic

"Multi-Dimensional" Arrays  RSS feed

 
Christopher Shrout
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will need at least a "3-dimensional" array in order to create multiple "series" to be charted on an xy line graph. I understand the limitations of Java and that one can only create "an array of arrays". How do I "redimension" or re-instate an array to hold more entries?

Could someone provide me with a good example of creating a "multi-dimensional array" (3 dimensional would be quite useful!). Things in VB always seemed a little more straightforward...
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to be able to be able to change the sizes, you really want to be using Lists rather than arrays.

You could use Lists of Lists, but I'd actually suggest creating a Series class, and using a List<Series>. The Series could then contain arrays or Lists as appropriate.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one of the limitations of arrays is that you cannot re-size them. The best you can do is create a bigger one, copy the data from the smaller to the larger, then forget about the smaller one.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!