Why connection(List ...) class doesn't have variable number of parametes

I think It's more convenience to add element if there has some methods(constructers) like:

publicvoid addAll(E... es);

or

publicboolean AddAll(E... es) ;

or

public ArrayList(E ...es);

Message was edited by:

lihy70

[432 byte] By [lihy70a] at [2007-11-26 17:21:16]
# 1

There's nothing stopping you from writing such a method. There's also the Arrays.asList() method to help, if you want this sort of thing:List<String> list = new ArrayList<String>();

list.addAll(Arrays.asList("one", "two", "three"));

System.out.println(list); // [one, two, three]

~

yawmarka at 2007-7-8 23:49:16 > top of Java-index,Core,Core APIs...
# 2

I know Arrays.

But I think the collection is most used class,

Just like for , so there is enhance for.

I prefer there is some method like

public void addAll(E ... es) ;

to replace

addAll(Arrays.asList(e1, e2 ...));

lihy70a at 2007-7-8 23:49:16 > top of Java-index,Core,Core APIs...
# 3
> I prefer there is some method...Okay, thanks for letting us know.P.S. Please refer to the previous statement: "There's nothing stopping you from writing such a method."~
yawmarka at 2007-7-8 23:49:16 > top of Java-index,Core,Core APIs...
# 4
This has nothing to do with concurrency. Please post and respond in an appropriate forum.Thank you.
davidholmesa at 2007-7-8 23:49:16 > top of Java-index,Core,Core APIs...