Possible Duplicate:
What is the ellipsis for in this method signature?
For example: protected void onProgressUpdate(Context... values)
Possible Duplicate:
What is the ellipsis for in this method signature?
For example: protected void onProgressUpdate(Context... values)
They're called varargs, and were introduced in Java 5. Read http://download.oracle.com/javase/1.5.0/docs/guide/language/varargs.html for more information.
In short, it allows passing an array to a method without having to create one, as if the method took a variable number of arguments. In your example, the following four calls would be valid :
onProgressUpdate();
onProgressUpdate(context1);
onProgressUpdate(context1, context2, context3);
onProgressUpdate(new Context[] {context1, context2});
Three dots are called ellipsis. Method can be called any number of values of type Context. You can call that method with no value also.
It means that the values
argument is an optional array of Context
objects. So you could call the "onProgressUpdate" function in the following ways:
onProgressUpdate(); // values is an empty array.
onProgressUpdate(new Context[] { new Context() }); // values has one item.
onProgressUpdate(context1, context2); // values has two items.
See the varargs language feature introduced in Java 1.5.
That means that you can put a range of values :
onProgessUpdate(c1,c2,c3);