0

Possible Duplicate:
What is it called when you use object… as a parameter?

I'm seeing this kind of pattern a lot in Java. My question is, what is the ... for, and what's it called?

Community
  • 1
  • 1
superluminary
  • 47,086
  • 25
  • 151
  • 148

2 Answers2

4

It's called "varargs":

http://docs.oracle.com/javase/1.5.0/docs/guide/language/varargs.html

It's a feature of Java 1.5+ and has been around for nearly a decade.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
  • It's also called "variable arity" in the Java Language Specification: http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.1 – Joseph Ottinger Jun 29 '12 at 13:13
1

OK...

(Params... params)

"..." means variable length of parameters.

Moreover doInBackground a method to do the process intensive work in non-ui thread, present in SwingWorker class Java, and in AsyncTask<> in Android.

Kumar Vivek Mitra
  • 33,294
  • 6
  • 48
  • 75