What is the use of ... (triple dot operator)
for Example please explain below code :
public PausableThreadPoolExecutor(...) { super(...); }
From which JDK version it was introduced.. ?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
What is the use of ... (triple dot operator)
for Example please explain below code :
public PausableThreadPoolExecutor(...) { super(...); }
From which JDK version it was introduced.. ?
Do an internet search for the term "java varargs" for java specific info, or "programming ellipsis" for a more general description. Lots of info, for instance, the following link:
Varargs
That feature is called varargs, and it's a feature introduced in Java 5. It means that function can receive multiple String arguments:
The parameter that gets the ... must be the last in the method signature.
public void myMethod(String... strings){
for(String whatever : strings)
{
}
The spread operator allows you to expand an expression in places where you would expect multiple arguments (in functions) or multiple elements (in arrays).
let someArguments = ['hi','bye'];
function logArgs (arg1, arg2) {
return console.log(`${arg1} ${arg2}`);
}
logArgs(...someArguments); //hi bye