title: Kotlin Instantiate Immutable List
body: <p>I've started using Kotlin as a substitute for java and quite like it. However, I've been unable to find a solution to this without jumping back into java-land:</p>
  
  <p>I have an <code>Iterable&lt;SomeObject&gt;</code> and need to convert it to a list so I can iterate through it more than once. This is an obvious application of an immutable list, as all I need to do is read it several times. How do I actually put that data in the list at the beginning though? (I know it's an interface, but I've been unable to find an implementation of it in documentation)</p>
  
  <p>Possible (if unsatisfactory) solutions:</p>
  
  <pre><code>val valueList = arrayListOf(values)
  // iterate through valuelist
  </code></pre>
  
  <p>or</p>
  
  <pre><code>fun copyIterableToList(values: Iterable&lt;SomeObject&gt;) : List&lt;SomeObject&gt; {
      var outList = ArrayList&lt;SomeObject&gt;()
      for (value in values) {
          outList.add(value)
      }
      return outList
  }
  </code></pre>
  
  <p>Unless I'm misunderstanding, these end up with <code>MutableLists</code>, which works but feels like a workaround. Is there a similar <code>immutableListOf(Iterable&lt;SomeObject&gt;)</code> method that will instantiate an immutable list object?</p>