title: Kotlin - Get Maximum value in ArrayList of Ints
body: <p>I have this <code>ArrayList</code></p>
  <pre><code>var amplititudes: ArrayList&lt;Int&gt; = ArrayList()
  amplititudes.add(1)
  amplititudes.add(2)
  amplititudes.add(3)
  amplititudes.add(4)
  amplititudes.add(3)
  amplititudes.add(2)
  amplititudes.add(1)
  </code></pre>
  <p>I want to get the maximum value i.e 4. What will be the easiest way to find the max element? I know about the <code>max()</code> method , but it will forces me to use <code>?</code> with the return value since it could be <code>null</code>. Is there any solution which is better than this?</p>