Skip to content

Instantly share code, notes, and snippets.

@orekyuu
Created March 19, 2016 09:38
Show Gist options
  • Save orekyuu/4e57ca56c9849a0f20d7 to your computer and use it in GitHub Desktop.
Save orekyuu/4e57ca56c9849a0f20d7 to your computer and use it in GitHub Desktop.
package com.example;
import java.util.ArrayList;
import java.util.Comparator;
public class Main {
public static void main(String[] args) {
ArrayList<String> strings = new ArrayList<>();
String result = strings.stream()
.max(Comparator.comparing(String::length))
.get();
System.out.println(result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment