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

public class Main {
    public static Object toArray(List<?> list, Class<?> componentType) {
        Object result = Array.newInstance(componentType, list.size());
        System.arraycopy(list.toArray(), 0, result, 0, list.size());
        return result;
    }
}