On Tue, 08 Sep 1998 17:59:26 +0200, Maarten van Leunen wrote:

>Howdie,
>
>Is there a way to expand arrays. Like, I want to put a unknown number of
>strings in an array.
>
>And then "return" the array of Strings in the Method.
>
>I read one string, and wish to add it to the array without having to
>define the amount of Strings in the array previously.

Generally I tend to use the java.util.Vector class if I really can not
know the size of the array before hand.  Then, if I need to make an
array from it, I just use the copyInto() method after building the
array of the right type and size.  For example:

        java.util.Vector v=new java.util.Vector();

        ///  add all sorts of String object to the vector

        String[] result=new String[v.size()];
        v.copyInto(result);


Michael Sinz -- Director of Research & Development, NextBus Inc.
mailto:[EMAIL PROTECTED] --------- http://www.nextbus.com
My place on the web ---> http://www.users.fast.net/~michael_sinz

Reply via email to