mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-17 15:50:53 +07:00
11 lines
280 B
Java
11 lines
280 B
Java
// "Avoid mutation using Stream API 'max()' operation" "true-preview"
|
|
|
|
import java.util.*;
|
|
|
|
public class Main {
|
|
void test(List<String> list) {
|
|
String longest = list.stream().max(Comparator.comparingInt(String::length)).orElse(null);
|
|
System.out.println(longest);
|
|
}
|
|
}
|