Here you can find the source of convert(Collection
public static String[] convert(Collection<String> c)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.Collection; import java.util.List; public class Main { public static String[] convert(Collection<String> c) { if (c == null) return null; String[] r = new String[c.size()]; int i = 0; for (String s : c) { r[i] = s;/*from ww w. j a v a 2s. c o m*/ i++; } return r; } public static List<String> convert(String[] c) { List<String> l = new ArrayList<String>(); if (c != null) { for (String s : c) { if (s != null) { l.add(s); } } } return l; } }