[stringtemplate-interest] handling of arrays

John Snyders jjsnyders at rcn.com
Sun Jan 28 18:44:26 PST 2007


> -----Original Message-----
> From: stringtemplate-interest-bounces at antlr.org
> [mailto:stringtemplate-interest-bounces at antlr.org]On Behalf Of Terence
> Parr
> Sent: Saturday, January 27, 2007 6:38 PM
> To: StringTemplate
> Subject: Re: [stringtemplate-interest] handling of arrays
>
> On Jan 16, 2007, at 9:40 PM, John Snyders wrote:
>
> > I noticed in ASTExpr.java the method convertArrayToList.
>
> it is.  just done to make things consistent...else have to check for
> arrays everyone.  gross, eh?
>
> > It seems to me that this is wasteful. I have not looked at it too
> > deep but why not handle arrays like other collections and wrap them
> > in an ArrayIterator inside convertAnythingIteratableToIterator.
>
> Interesting...ArrayIterator, eh?  Does Sun have a standard one?  I
> don't see it.  Do you mean I should create one real quick?

There isn't one in the Java SDK (as far as I know) but jakarta commons has
one
http://jakarta.apache.org/commons/collections/api-release/org/apache/commons
/collections/iterators/ArrayIterator.html

ST probably shouldn't rely on this so you can create your own. It is
straight forward.
I created one before I found the one in commons collections. I can give it
to you if you like
(assuming I can find it). But again I didn't think this through fully.

>
> Ter
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest


More information about the stringtemplate-interest mailing list