velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr. <>
Subject Re: array lengths
Date Thu, 12 Dec 2002 16:23:32 GMT

On Thursday, December 12, 2002, at 11:06 AM, Iain Young wrote:

> Hi folks, hopefully a quick one this.
> I have an array of objects which I want to find the length of, however 
> when
> I try...
> 	$objects.length

Yes - because length isn't really a method, but an artificial construct 
of the language taken care of for you by the compiler.

> I get $objects.length rendered instead of the expected array length 
> value.
> Is it possible get this value, or do I have to get hold of arrays as
> ArrayLists and call the size() method instead?

That would be the best way, or add a tool to the context that does 
something like

public int arrLen(Object[] arr)
     return arr.length;

Geir Magnusson Jr                                   203-355-2219(w)
Adeptra, Inc.                                       203-247-1713(m)

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message