[stringtemplate-interest] ST4: varargs version of add ?

Terence Parr parrt at cs.usfca.edu
Thu Feb 3 18:21:06 PST 2011


Hi. I was thinking about this but wasn't sure about it. so the usage is something like:

st.add("names", "parrt", "tombu", "dmose");

Is that what you're thinking?

Ter

On Feb 1, 2011, at 6:54 PM, Collin Fagan wrote:

> Hi, 
> 
> I find I would like to pass multiple items to add. Would it be possible  to get a varargs version of add?
> 
> Maybe something like this?
> 
>    public synchronized void add(String name, Object value, Object ... moreValues) {
>        List<Object> allObjects = new ArrayList<Object>();
>        allObjects.add(value);
>        Collections.addAll(allObjects, moreValues);
>        add(name, allObjects);
>    }
> 
> Of course this isn't the most efficient implementation one could write but we could deal with that if anyone liked the idea of a varargs add.
> 
> Collin
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest



More information about the stringtemplate-interest mailing list