Hi all,
I'm currently developing an application in Delphi that in a few months I'll
need to port Java, witch I'm about to start studying, so I needed to know
if Java supports dynamic arrays.
Thanks, Poochie
Christophe Vanfleteren - 17 Apr 2004 22:32 GMT
> Hi all,
>
[quoted text clipped - 3 lines]
>
> Thanks, Poochie
Java only has fixed size arrays.
There is a very powerfull Collections framework that offers lots of handy
datastructures though:
http://java.sun.com/docs/books/tutorial/collections/index.html

Signature
Kind regards,
Christophe Vanfleteren
Roedy Green - 18 Apr 2004 00:19 GMT
>I'm currently developing an application in Delphi that in a few months I'll
>need to port Java, witch I'm about to start studying, so I needed to know
>if Java supports dynamic arrays.
Java lets you allocate arrays of any size determined at runtime, but
they are fixed. To grow you must allocate a new array and copy, like
C. Java also has the Vector collection that is like an array that
grows automatically as needed. There are many other Collections that
come built-in. In Java 1.5 Vectors can contain specific object types.
Before that, the contents are considered generic objects, and it up to
you when you fish them out to manually cast them back to what they
really are.
See http://mindprod.com/jgloss/collection.html
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Bryce (Work) - 19 Apr 2004 14:26 GMT
>Hi all,
>
>I'm currently developing an application in Delphi that in a few months I'll
>need to port Java, witch I'm about to start studying, so I needed to know
>if Java supports dynamic arrays.
Vectors..
A whole Collections API.
--
now with more cowbell
Stefan Waldmann - 20 Apr 2004 10:57 GMT
>>Hi all,
>>
[quoted text clipped - 5 lines]
>
> A whole Collections API.
Hi,
or ArrayList instead of Vector, if you don't have to use it in
multithreaded environment. ArrayList is unsynchronized and therefore
more performant than Vector.
Regards,
Stefan