Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 *  Copyright Gergely Nagy <greg@webhejj.hu>
 *
 *  Licensed under the Apache License, Version 2.0; 
 *  you may obtain a copy of the License at:
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 */

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class Main {
    /**
     * Same as in java.util.Collections, but returns list to allow daisy chaining calls
     */
    public static <T extends Comparable<? super T>> List<T> sort(List<T> list) {
        Collections.sort(list);
        return list;
    }

    /**
     * Same as in java.util.Collections, but returns list to allow daisy chaining calls
     */
    public static <T> List<T> sort(List<T> list, Comparator<T> comparator) {
        Collections.sort(list, comparator);
        return list;
    }
}