Saturday 15 February 2014

java - How to program a 3-dimensional Matrix using ArrayList and Array -


Here's my case, I want to create a matrix buffer for a 3D project which I'm working on.

  ArrayList & lt; ArrayList & lt; Object & gt; & Gt; Many people are proposing to do something like this on Stack Overflow  However   

Although this structure is causing issues because I need a fixed size matrix And I am aware that the operation on the complexity of the addition (i, object) On the other hand, the final nested level of my matrix requires a variable size so that the object is in the same condition, it just adds itself to the stack.

If you need a matrix with a variable length dimension 3, then why not an arrayalist [] []?

Obviously you are a generic matrix, but you can cast it from raw-type objects (think what you want):

  ArrayList & Lt; Object & gt; [] [] Box = (ArrayList & lt; Object & gt; [] []) New Array List [Length] [Width];   

This will have a variable length of 3 dimensions in a fixed size matrix. Remember to fill the matrix, however, to fill with the entire matrix will be filled blank.

No comments:

Post a Comment