I have an array of type Cell
. This is a 2D array.
Depending on certain conditions, I might have to resize this array and shift the Cell
objects one row or column down/right/left.
I was thinking of using the prototype pattern to copy the original array into another larger array.
Does this offer any more benefits over simply doing an array resize?
Edit: I realized that I have not mentioned my intent. I don't really need another object. I just want a larger array based on certain conditions.
The only reason this could be of help is if you are making a shallow copy: copying would save you the costs of creating new objects. The flip side of it is that all
Cell
objects inside the array would be shared among multiple 2D arrays; if this presents a problem, you should go back to creating arrays from scratch.