Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class Main {
    /**
     * Convert a {@link Collection} of <T> to a sorted {@link List} of <T>.
     */
    public static <T extends Comparable<T>> List<T> asSortedList(final Collection<T> collection) {
        final List<T> list = new ArrayList<>(collection);
        Collections.sort(list);
        return list;
    }
}