title: Is it possible to implement sequence programming with vararg in Kotlin?
body: <p>I've been trying sequence programming for processing the data I get from the vararg argument. I want to multiply every number in the list and add it to the new array list. Is it possible to use sequences.</p>
  <p>I attach the code below:</p>
  <pre><code>fun main() {
      val number = asList(10, 20, 30, 40, 50)
      print(number)
  }
  
  fun &lt;T&gt; asList(vararg input: T): List&lt;T&gt; {
      val result = ArrayList&lt;T&gt;()
      input.map {it * 2}.foreach(result.add(it))
      return result
  }
  </code></pre>
  <p>Here is the error I get:
  <a href="https://i.stack.imgur.com/o4T8u.png" rel="nofollow noreferrer">enter image description here</a></p>