Re: Array Question

From: Chris (chris2k01_at_hotmail.com)
Date: 12/21/03


Date: Sun, 21 Dec 2003 21:29:32 GMT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Dixon - Depictions.net wrote:

> Hi Everyone.
>
> Bit new to Java and I have question about arrays. I have wrote some
> code to look for certain substrings within a larger string which
> work fine. I would like to store each substring in an array, however
> I don't know how many there will be. All the example I have found
> for arrays only show how to predefine the size of the array, however
> I would like to expand it by one each time I need to. Can anyone let
> me know how to do this.
>
> Thanks
>
> Best Regards
>
>>>> Andrew

Hi,
I think you'd like to try using java.util.ArrayList. It's really
simple to use, you can keep adding objects over and over without
knowing the initial size, and you can convert it to a real array when
you're finished very easily. Take a look!

- --
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/5eaQwxczzJRavJYRAqqbAJ46RB8qDqoy5FjXtZ2cFa2rNGan6QCfa67F
hKzHPH2mx0Ufg8RKWbttnrc=
=G2b8
-----END PGP SIGNATURE-----



Relevant Pages