Please do not use this tag to refer to the spread syntax "..." in JavaScript. Use [spread-syntax] instead. In Groovy, the spread operator (*) is to extract entries from a collection and provide them as individual entries. This can be useful for converting collections to individual parameters on method calls. In Kotlin, the spread operator (*) allows a variable number of arguments (vararg) to be passed via the named form.
Questions tagged [groovy-spread]
2 questions
                    
                    10
                    
            votes
                
                2 answers
            
        How does one pass an Array to a vararg Int function using the Spread Operator? 
        I have a vararg function that takes multiple Ints. I have an Array that I'd like to use as input.
An unsuccessful attempt:
Here is my attempt to call the function using the Spread Operator:
fun printNumbers(vararg numbers: Int) {
   … 
        
        byxor
        
- 5,930
 - 4
 - 27
 - 44
 
                    5
                    
            votes
                
                1 answer
            
        Java translation of groovy spread operator
Given:
class Car {
    String make
    String model
}
def cars = [
       new Car(make: 'Peugeot', model: '508'),
       new Car(make: 'Renault', model: 'Clio')]     
def makes = cars*.make  
How does cars*.make works behind the scene in java?…
        
        extraRice
        
- 323
 - 2
 - 17