Here you can find the source of asArray(List
public static String[] asArray(List<String> list)
//package com.java2s; /*/*w w w.jav a2 s.co m*/ * Copyright (C) 2008-2011 by Simon Hefti. All rights reserved. * Licensed under the EPL 1.0 (Eclipse Public License). * (see http://www.eclipse.org/legal/epl-v10.html) * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. * * Initial Developer: Simon Hefti */ import java.util.List; public class Main { public static String[] asArray(List<String> list) { if (null == list) { return null; } String[] res = new String[list.size()]; list.toArray(res); return res; } }