Here you can find the source of toStringArraySafe(List list)
private static String[] toStringArraySafe(List list)
//package com.java2s; //License from project: LGPL import java.util.List; public class Main { private static String[] toStringArraySafe(List list) { while (list.contains(null)) { list.remove(null);/*from w w w .j a v a2 s . c o m*/ } return ((List<String>) list).toArray(new String[list.size()]); } }