public static <T extends Comparable<? super T>> void sort(List<T> list) { Object[] a = list.toArray(); Arrays.sort(a); ListIterator<T> i = list.listIterator(); for (int j=0; j<a.length; j++) { i.next(); i.set((T)a[j]); } } From: JDK Collections.sort方法 Read More
package com.xx.tests;import java.util.HashMap;import java.util.Map;public enum Season { Spring { @Override public String toString() { return "春天"; } }, Summer{ @Override public String toString() { return "夏天"; } }, Autumn{ @Override public String toString() { return "秋天" Read More