// Find longest String in a List public void changeList(List<String> list) { String longestString = list.stream().max(Comparator.comparingInt(String::length)).get(); }