[stringtemplate-interest] ST4: varargs version of add ?
Collin Fagan
collin.fagan at gmail.com
Fri Feb 4 07:57:44 PST 2011
Yes, I'm sorry if it's too trivial but varags is around mostly for
convenience and I though this would a convient place to put it.
Collin
On Fri, Feb 4, 2011 at 9:52 AM, Terence Parr <parrt at cs.usfca.edu> wrote:
> 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
>>
>
>
>
> _______________________________________________
> 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/3c8fca28/attachment.html
More information about the stringtemplate-interest
mailing list