Actually, because for compatibility reasons, the signature of a method, which is using varargs function(Object... args) is the equivalent of a method declared with an array function(Object[] args).

Therefore in order to pass and spread any collection to function which expects varargs, you need to transform it to the array:

import java.util.Arrays;
import java.util.stream.Stream;

public class MyClass {
  
  static void printMany(String ...elements) {
     Arrays.stream(elements).forEach(System.out::println);
  }
  
  public static void main(String[] args) {
    printMany("one", "two", "three");
    printMany(new String[]{"one", "two", "three"});
    printMany(Stream.of("one", "two", "three").toArray(String[]::new));
    printMany(Arrays.asList("foo", "bar", "baz").toArray(new String[3]));
  }
}

All these calls of printMany will print:

one

two

three

It's not exactly the same as spread operator, but in most cases, it's good enough.

Answer from Krzysztof Atłasik on Stack Overflow
🌐
LogicBig
logicbig.com › tutorials › misc › groovy › spread-operator.html
Groovy Operators - Spread Operator
December 18, 2018 - Cannot cast object '[1, 3, 5]' with class 'java.util.ArrayList' to class 'java.lang.Integer' When spread operator (*) used inside a list literal, the elements are inlined into the list: def numbers = [1,2,3] def numbers2 = [0, *numbers, 4,5,6] ...
Discussions

Java translation of groovy spread operator - Stack Overflow
How does cars*.make works behind the scene in java? Does it create a new Map object in the heap and combine two maps? ... I took a look at the bytecode, and the only maps involved are the maps that are created to initialize the Car objects. Once the two car objects are initialized, they are put into a list. The spread operator ... More on stackoverflow.com
🌐 stackoverflow.com
August 3, 2015
Allow spread operator as parameters
The proposal This issue proposes a Dart language feature which takes inspiration from the Java lang spread operator on functions/methods parameters. Having such a feature allows creation of infinit... More on github.com
🌐 github.com
5
June 6, 2022
How often do you use the spread operator "*" ?
I use it when I have a naturally List or Array type that I need to use with a function that accepts a varargs of the same type. Syntactic sugar really. It's cool for showing off to Java developers. 🤣 More on reddit.com
🌐 r/Kotlin
9
7
January 7, 2021
Question about varargs in Kotlin
There is only one major difference between Kotlin and Java varargs. Java pass the varargs array as is but in Kotlin you need to unpack your varargs array with spread operator (*array). This Kotlin feature could be used for combining values from varargs array and fixed ones inside tour function, all in single call. (May be it could help you) More on reddit.com
🌐 r/Kotlin
3
1
March 27, 2019
🌐
Medium
medium.com › @aayushid159 › java-varargs-vs-kotlin-varargs-spread-operator-in-kotlin-eb45b7a6f465
Java Varargs vs Kotlin Varargs & Spread Operator in Kotlin | by Aayushi | Medium
April 6, 2018 - Technically, this feature is called using a spread operator, but in practice it’s as simple as putting the * character before the corresponding argument: fun main(args: Array<String>) { val list = listOf("args: ", *args) //Spread operator ...
🌐
Iditect
iditect.com › faq › java › java-spread-operator.html
Java spread operator
In Java, there is no spread operator like you might find in some other programming languages (e.g., JavaScript).
🌐
GitHub
gist.github.com › ORESoftware › 3c4f25de70e9d1849572752c4b59d1a9
Varargs and spread operator in Java · GitHub
Varargs and spread operator in Java · Raw · spread.md · public void run(Condition... c){ } ArrayList<Condition> list = new ArrayList<>(); run(...list); // nope run(list...); // nope run(list); // nope // fml · Sign up for free to join this conversation on GitHub.
🌐
Mrhaki
blog.mrhaki.com › 2009 › 09 › groovy-goodness-spread-operator.html
Groovy Goodness: the Spread Operator - Messages from mrhaki
November 26, 2010 - class Simple { String speak(Integer n, String text, Date date) { def out = new StringBuffer() n.times { out << "Say $text on ${date.format('yyyy-MM-dd')}.\n" } out } } // Spread params list for speak() method. def params = [ 2, "hello world", new Date().parse("yyyy/MM/dd", "2009/09/01") ] assert '''Say hello world on 2009-09-01. Say hello world on 2009-09-01. ''' == new Simple().speak(*params) // Add a list to another list. def list = ['Groovy', 'Java'] assert ['Groovy', 'Java', 'Scala'] == [*list, 'Scala'] // Add a range to a list.
Find elsewhere
🌐
Coding Blocks Blog
blog.codingblocks.com › 2016 › the-3-dots-that-brings-a-bit-of-java-to-javascript
The 3 dots that brings a bit of Java to Javascript
December 9, 2018 - Now, with ECMAScript2015 (ES6) having been standardized, we have the spread and rest operators in Javascript, that does something similar, and even better it has support of varargs both in function definition, as well as function calls.
🌐
Baeldung
baeldung.com › home › java › core java › varargs in java
Varargs in Java | Baeldung
January 8, 2024 - When we use varargs with generic types, as there’s a potential risk of a fatal runtime exception, the Java compiler warns us about a possible unsafe varargs usage: warning: [varargs] Possible heap pollution from parameterized vararg type T ... We don’t store anything in the implicitly created array. In this example, we did store a List<Integer> in that array
🌐
Medium
alexanderkilroy.medium.com › java-in-a-nutshell-optionals-streams-api-83c90dcdc8ab
Java In A Nutshell — Optionals & Streams API | by Alexanderkilroy | Medium
January 7, 2022 - Before we jump into Streams, I just wanna’ make sure we’re aware of the ... operator as it’s used within the Streams API. It effectively allows us to spread a list of values, that aren’t actually a list or collection into a method, see the below:
🌐
Medium
proandroiddev.com › kotlins-vararg-and-spread-operator-4200c07d65e1
Kotlin’s vararg and spread operator | by Tibi Csabai | ProAndroidDev
January 27, 2019 - In this article we will start by ... and spread operator, and then explore some more elaborated scenarios — while analysing what happens behind the scenes. Kotlin also supports declaring a function that can have a variable number of arguments. You can do that by prefixing parameter name with the vararg modifier: fun format(format: String, vararg args: Any) In Java, the vararg parameter has to be the last one in the parameters list — so you ...
🌐
Oracle
docs.oracle.com › en › java › javase › 11 › docs › api › jdk.scripting.nashorn › jdk › nashorn › api › tree › SpreadTree.html
SpreadTree (Java SE 11 & JDK 11 )
January 20, 2026 - Nashorn JavaScript script engine and APIs, and the jjs tool are deprecated with the intent to remove them in a future release. A tree node for spread operator in array elements, function call arguments.
🌐
Groovy
groovy-lang.org › operators.html
The Apache Groovy programming language - Operators
The Spread-dot Operator (*.), often abbreviated to just Spread Operator, is used to invoke an action on all items of an aggregate object. It is equivalent to calling the action on each item and collecting the result into a list:
🌐
GitHub
github.com › dart-lang › language › issues › 2278
Allow spread operator as parameters · Issue #2278 · dart-lang/language
June 6, 2022 - Under the hood, the format method makes use of spread operator on parameters like so: //java // implementation is not needed format(@NotNull String text, Object... args); If we need to simulate this method with the actual dart version, we will use list instead, like so:
Author   dart-lang
🌐
Programming.Guide
programming.guide › java › passing-list-to-vararg-method.html
Java: Passing a list as argument to a vararg method | Programming.Guide
'String...' behaves similarly to 'String[]', so just use List.toArray to convert your list to an array: yourVarargMethod(yourList.toArray(new String[0]));
🌐
Javatpoint
javatpoint.com › es6-spread-operator
ES6 Spread Operator - javatpoint
ES6 operators The operator can be defined as a symbol that tells the system to implement a particular operation. In JavaScript, there is a rich set of operators, and by using specific operators, you can perform any particular task.
🌐
Medium
medium.com › @bluethinkin › enhancing-enterprise-solutions-spread-operator-in-java-crm-sharepoint-integration-aef33c6c7991
Enhancing Enterprise Solutions: Spread Operator in Java & CRM-SharePoint Integration | by SEO BlueThinkIn | Medium
February 21, 2025 - While Java does not have a built-in spread operator like JavaScript, its functionality can be mimicked through modern techniques introduced in Java versions 8 and above.