代码
提交代码
import java.util.List; import java.util.stream.Stream; import java.util.stream.Collectors; public class Test{ public static void main(String...s){ List<String> collected = Stream.of("a","b","c").collect(Collectors.toList()); String maxChar = collected.stream().collect(Collectors.maxBy(String::compareTo)).get(); System.out.println(maxChar); } }
运行结果