对字母升序排序
List<String> letterList = Arrays.asList("T", "A", "G", "C", "O");
常规实现方式
Collections.sort(letterList, new Comparator<String>() { @Override public int compare(String a, String b) { return a.compareTo(b); } });
Lambda表达式方式
Collections.sort(letterList, (String a, String b) -> { return a.compareTo(b); });
更短的Lambda表达式
Collections.sort(letterList, (String a, String b) -> a.compareTo(b));
还有更短的表达式
letterList.sort((a, b) -> a.compareTo(b));