title: Multi-type ArrayList as function argument in Kotlin
body: <p>I want to send an array list containing multiple types to a function (I know it is not a good practice, it is on purpose).</p>
  
  <p>I don't know what type should I use for the 'numbers' argument of the function. And then how to iterate over it. I tried List but that needs a .</p>
  
  <p>Thanks.</p>
  
  <pre><code>fun sum(numbers : ArrayList) : Double
  {
      var sum:Double = 0.0
  
      for(i in 0 until numbers.itemCount)
      {
          var temp:Double = numbers.getItem(i).toDouble()
          sum = sum + temp
      }
  
      return sum
  }
  
  fun main()
  {
      var ar = listOf("99", 1, 3.1)
  
      println(sum(ar))
  }
  </code></pre>