Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to resize a multidimensional array?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?"
 
Laurent Quenon
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Whose rules are you playing by? This tiny ad doesn't respect those rules:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic