Here you can find the source of listToArray(List list)
public static Object[] listToArray(List list)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static Object[] listToArray(List list) { return list.stream().toArray(Object[]::new); }//from w ww . j a v a2 s . c o m }