title: arg max in Java 8 streams?
body: <p>I often need the maximum element of a collection according to the maximization of a  criterion which produces a double or int value. Streams have the max() function which requires me to implement a comparator, which I find cumbersome. Is there a more concise syntax, such as <code>names.stream().argmax(String::length)</code> in the following example?</p>
  
  <pre><code>import java.util.Arrays;
  import java.util.Comparator;
  import java.util.List;
  
  public class ArgMax
  {
      public static void main(String[] args)
      {
          List&lt;String&gt; names = Arrays.asList("John","Joe","Marilyn");
          String longestName = names.stream().max((String s,String t)-&gt;(Integer.compare(s.length(),t.length()))).get();
          System.out.println(longestName);
      }
  }
  </code></pre>