Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.lang.reflect.Array;

import java.util.Collection;

public class Main {

    public static <T> T[] convertArrayToList(Collection<T> list) {
        return (T[]) (list.size() > 0
                ? list.toArray((Object[]) Array.newInstance(list.iterator().next().getClass(), list.size()))
                : null);
    }
}