Php and Perl have a structure called assosiative arrays. With keys and
values. Does Java have a similar structure ?
Regards
Rune
Alex Buell - 16 May 2005 10:34 GMT
On Mon, 16 May 2005, Rune Runnest wrote:
> Php and Perl have a structure called assosiative arrays. With keys and
> values. Does Java have a similar structure ?
Yes, there's the Map class.

Signature
http://www.munted.org.uk
Drive carefully and find your true love.
--657922-1700622387-1116236071=:13018--
Steve Horsley - 16 May 2005 18:42 GMT
> Php and Perl have a structure called assosiative arrays. With keys and
> values. Does Java have a similar structure ?
>
> Regards
> Rune
See java.util.Map and its subclasses.
You have to use them as classes - there's no special language
support for them, so instead of (python maybe):
x = properties['WibbleRate']
you must use
x = properties.get("WibbleRate");
Steve
bugbear - 17 May 2005 10:26 GMT
> Php and Perl have a structure called assosiative arrays. With keys and
> values. Does Java have a similar structure ?
Yes - many kinds of; it even has "associative arrays"
that maintain insertion order, which perl doesn't.
See the MANY implementations of Map, both in
standard Java, and many "collection"
type libraries such as Apache/Jakarta
BugBear