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
🌐
Iditect
iditect.com › faq › java › java-spread-operator.html
Java spread operator
Example of using the Stream API to "spread" elements from a collection: List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5); // Stream operations to process each element numbers.stream().forEach(System.out::println);
🌐
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.
🌐
HowToDoInJava
howtodoinjava.com › home › typescript › typescript / javascript spread operator
TypeScript / JavaScript Spread Operator (with Examples)
July 3, 2023 - The spread operator is used to ... or Javascript. The spread operator (in the form of ellipsis) can be used in two ways: Initializing arrays and objects from another array or object ...
🌐
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 - In Java, you pass the array as is, whereas Kotlin requires you to explicitly unpack the array. Technically, this feature is called using a spread operator, but in practice it’s as simple as putting the * character before the corresponding argument:
🌐
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.
🌐
GitHub
github.com › dart-lang › language › issues › 2278
Allow spread operator as parameters · Issue #2278 · dart-lang/language
June 6, 2022 - First of all, this is just an example of the usage, I think something like this makes understanding the idea. As evident the number of %s is variable it can be one or none. 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
Find elsewhere
🌐
DhiWise
dhiwise.com › post › the-kotlin-spread-operator-unfolding-arrays-into-arguments
Maximizing Efficiency with the Kotlin Spread Operator
June 6, 2024 - When the Kotlin spread operator is used in a function call, the compiler unwraps each element from the array and passes them into the function body as separate parameters. This process involves a bytecode-level operation that reconstructs the arguments into an array again because Java methods receive vararg arguments as arrays.
🌐
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:
🌐
Java Code Geeks
javacodegeeks.com › home › web development › javascript
Level Up Your JavaScript: Mastering the ES6 Spread Operator - Java Code Geeks
March 22, 2024 - Using the Spread Operator (…) with Math.max and Math.min allows us to unpack the elements of the numbers array and pass them as individual arguments to these functions. This eliminates the need for a loop to iterate through the array and compare elements manually. These are just a few examples of the many ways you can leverage the ES6 Spread Operator to write cleaner, more efficient, and more readable JavaScript code.
🌐
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.
🌐
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 - And check how it can help inject arrays into functions · function myFunction(x, y, z) { } var args = [0, 1, 2]; myFunction(...args); Take a look at how the rest parameters syntax works. This uses the spread operator we saw above · function fun1(...theArgs) { console.log(theArgs.length); } ...
🌐
GeeksforGeeks
geeksforgeeks.org › es6-spread-operator
ES6 Spread Operator | GeeksforGeeks
April 14, 2023 - The JavaScript spread operator is denoted by three dots (...). The spread operator helps the iterable objects to expand into individual elements. Iterable objects are those on which we can use a loop, for example, Array, Map, Set, ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript-spread-operator
JavaScript Spread Operator | GeeksforGeeks
Below is an example of adding properties to an object using spread operator. ... We have a complete list of Javascript Operators, to check those please go through the Javascript Operators Complete Reference article. ... Operator precedence refers to the priority given to operators while parsing a statement that has more than one operator performing operations in it.
Published   November 11, 2024
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › Spread_syntax
Spread syntax (...) - JavaScript - MDN Web Docs - Mozilla
May 22, 2026 - The spread (...) syntax allows an iterable, such as an array or string, to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected. In an object literal, the spread syntax enumerates the properties of an object and adds the key-value ...
🌐
W3Schools
w3schools.com › howto › howto_js_spread_operator.asp
How To Use the Spread Operator (...) in JavaScript
Learn how to use the three dots operator (...) a.k.a the spread operator in JavaScript.
🌐
Scaler
scaler.com › home › topics › spread operator in javascript
Spread Operator in JavaScript
February 23, 2024 - In the below example, only the first three elements are added. ... In the case of multiple arguments to a function, the spread operator takes the required number of parameters and ignores the rest. The spread operator in JavaScript is denoted by three dots (...)