aspose file tools
The moose likes Java in General and the fly likes How to resize a multidimensional array? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How to resize a multidimensional array?" Watch "How to resize a multidimensional array?" New topic
Author

How to resize a multidimensional array?

Laurent Quenon
Greenhorn

Joined: Dec 09, 2003
Posts: 11
This is the code I'm using for a one dimension array:
if (nDates >= dates.length)
{
Calendar tmp[] = new Calendar[dates.length + 10];
System.arraycopy(dates, 0, tmp, 0, dates.length);
dates = tmp; // copies the array reference
}
How can I transpose this to a multidimensional array like :
String fieldvaluearray [][] = new String [MAX][MAX]
Thanks a lot for your help...
Greetings.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24061
    
  13

I'm afraid I don't understand your intention; maybe this is just because your example arrays are of two different data types -- and furthermore, I'm not sure how the subject (regarding resizing) has to do with the rest of the post.
Which is a long way of saying "can you explain your question in a bit more detail, please?"


[Jess in Action][AskingGoodQuestions]
Laurent Quenon
Greenhorn

Joined: Dec 09, 2003
Posts: 11
Never mind...
I just wanted to reize my array, but I did not understood correctly first that a multidimensional array is an array of array...
So to resize a multidimensional array I just have to use the same code as I mentionned before but for only the first dimension(row) of my array(as in this case I know that second dimension(column)will contain always two column).
Sorry fo rthe silly question...
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to resize a multidimensional array?
 
Similar Threads
Multidimensional arrays
Multidimensional array
multidimensional array
Multidimensional Arrays
Multidimensional ArrayList