title: Find max on BigDecimal list using java 8
body: <p>Let's suppose that I have a class like this : </p>
  
  <pre><code>public class A {
      private int id;
      private BigDecimal amount;
  }
  </code></pre>
  
  <p>And I have a <code>List&lt;A&gt;</code>. How can I find the maximum amount of all <code>A</code> objects in the list using Java 8 stream ? </p>
  
  <p>This method : </p>
  
  <pre><code>List&lt;A&gt; brol = new ArrayList&lt;&gt;();
  BigDecimal max = brol.stream().max(Comparator.comparing(A -&gt; A.getAmount())).get().getAmount();
          System.out.println("MAX = " + max);
  </code></pre>
  
  <p>Gives <code>NoSuchElementException</code> so I should create a specific comparator for this ? </p>