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
  • 43,182
  • 23
  • 145
  • 146

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
  • 156,572
  • 25
  • 250
  • 300
  • 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
  • 32,904
  • 6
  • 47
  • 76