AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Array Question

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
JavaJunkie
Guest





PostPosted: Sat Apr 03, 2004 5:42 am    Post subject: Array Question Reply with quote



I've been trying to find a way to resize an array after it has been instantiated, but haven't had any luck. I was wondering if anyone could help me.

Example:

double[][] blurry = new double[50][3];

now sometime later in my code - I realize that the array cannot hold all of my information - I really needed it to be
double[][] blurry = new double[5000][3];

- is there anyway to do this on the fly - altering the already existing array - rather than just creating a new instance of an array?



Thanks:]
Back to top
JavaJunkie
Guest





PostPosted: Sat Apr 03, 2004 6:46 am    Post subject: Array Question Reply with quote



I've been trying to find a way to resize an array after it has been instanciated, but haven't had any luck.

Example:

double[][] dblArray = new double[50][3];

now sometime later in my code - I realize that the array cannot hold all of my information - I really needed it to be
double[][] dblArray = new double[5000][3];

- is there anyway to do this on the fly - altering the already existing array - rather than just creating a new instance of an array?



--
"Life is too short, to say, I will do it later or tomorrow. Live life to the fullest, Learn, Prosper, and most important of all, Love!"

Connie A




"JavaJunkie" <arroyoce (AT) comcast (DOT) net> wrote

I've been trying to find a way to resize an array after it has been instantiated, but haven't had any luck. I was wondering if anyone could help me.

Example:

double[][] blurry = new double[50][3];

now sometime later in my code - I realize that the array cannot hold all of my information - I really needed it to be
double[][] blurry = new double[5000][3];

- is there anyway to do this on the fly - altering the already existing array - rather than just creating a new instance of an array?



Thanks:]
Back to top
JavaJunkie
Guest





PostPosted: Sat Apr 03, 2004 7:36 pm    Post subject: Re: Array Question Reply with quote



Mark, thanks for the information. Will check out the link.

JJ

--




"Mark Haase" <mehaase (AT) earthlink (DOT) net> wrote

Quote:
In article <s9sbc.163508$1p.2068917@attbi_s54>,
"JavaJunkie" <arroyoce (AT) comcast (DOT) net> wrote:

- is there anyway to do this on the fly - altering the already existing
array
- rather than just creating a new instance of an array?

Nope, Java arrays are fixed in size. If you need a larger one you'll
have to create it and copy over all the information from the old one. Or
consider using a Vector -- although there's no guarantee that it does
anything more efficient.

--
|/| /| |2 |
mehaase(at)sas(dot)upenn(dot)edu



Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.