Possible Duplicate:
What is the ellipsis for in this method signature?
I saw "T... elements" in java code. what does that mean? thanks!
It means, you can pass all T variables you want to a method.
If a method is:
public void myMethod(String... a)
{
}
You can make call with all String objects you want to that method:
myMethod("s1");
myMethod("s1", "s2");
myMethod("s1", "s2", "s3");
myMethod("s1", "s2", "s3", "s4");
Here's Java official documentation on that language feature. It was introduced in Java 5.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With