[stringtemplate-interest] ST4: varargs version of add ?
Terence Parr
parrt at cs.usfca.edu
Fri Feb 4 07:52:09 PST 2011
isn't that just
st.add("names", "parrt");
st.add("names", "tombu");
then?
Ter
On Feb 4, 2011, at 5:30 AM, Collin Fagan wrote:
> Yes thats it. It removes the necessity for Arrays.asList() or new Object[] when you want to add just a specific few items.
>
> Collin
>
> On Thu, Feb 3, 2011 at 8:21 PM, Terence Parr <parrt at cs.usfca.edu> wrote:
> 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
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20110204/dbdfe203/attachment.html
More information about the stringtemplate-interest
mailing list