Here you can find the source of sort(List
@SuppressWarnings("rawtypes") public static <E extends Enum> List<E> sort(List<E> source)
//package com.java2s; /******************************************************************************* * Copyright (c) 2008 flowr.org - all rights reserved. This program and the accompanying materials are made available * under the terms of the Eclipse Public License (EPL) v1.0. The EPL is available at * http://www.eclipse.org/legal/epl-v10.html * Contributors: flowr.org - initial API and implementation ******************************************************************************/ import java.util.Collections; import java.util.Comparator; import java.util.List; public class Main { @SuppressWarnings("rawtypes") public static <E extends Enum> List<E> sort(List<E> source) { Collections.sort(source, new Comparator<E>() { @Override/*w w w. j av a 2 s . c o m*/ public int compare(E o1, E o2) { return o1.ordinal() - o2.ordinal(); } }); return source; } }