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.Arrays;

import java.util.List;

public class Main {
    /**
     * Convert an array to a list
     * @param array an array
     * @return List
     */
    public static <T> List<T> arrayToList(T array[]) {
        if (array != null) {
            List<T> list = new ArrayList<>();
            list.addAll(Arrays.asList(array));
            return list;
        }
        return null;
    }
}