importjava.util.*;publicclassMain{publicstaticvoidmain(String[] args){List list =Arrays.asList("one Two three Four five six one three Four".split(" "));System.out.println(list);System.out.println("max: "+Collections.max(list));System.out.println("min: "+Collections.min(list));}}
结果
上面的代码示例将产生以下结果。
[one,Two, three,Four, five, six, one, three,Four]
max: three
min:Four