Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.*;

public class Main {
    public static <T> List<T> immutableList(Collection<? extends T> list) {
        if (list == null)
            return Collections.emptyList();
        return Collections
                .unmodifiableList(list instanceof List ? (List<? extends T>) list : new ArrayList<T>(list));
    }

    public static <T> List<T> immutableList(T... list) {
        if (list == null)
            return Collections.emptyList();
        return immutableList(Arrays.asList(list));
    }
}