Java examples for Collection Framework:Array Convert
Convert list to Array
//package com.java2s; import java.util.List; public class Main { public static void main(String[] argv) { List oList = java.util.Arrays.asList("asdf", "java2s.com"); System.out.println(java.util.Arrays.toString(list2Array(oList))); }// www.ja v a2s . c o m public static <T> T[] list2Array(List<T> oList) { Object[] oArray = oList.toArray(new Object[] {}); T[] ts = (T[]) oArray; return ts; } }