Here you can find the source of toStringArray(final Set> set)
Parameter | Description |
---|---|
set | a parameter |
public static String[] toStringArray(final Set<?> set)
//package com.java2s; //License from project: Apache License import java.util.Iterator; import java.util.List; import java.util.Set; public class Main { /**/*from w ww . ja v a2 s . c om*/ * Return a Set as a String array * @param set * @return */ public static String[] toStringArray(final Set<?> set) { final String[] f = new String[set.size()]; int i = 0; for (final Iterator<?> iter = set.iterator(); iter.hasNext(); i++) { f[i] = iter.next().toString(); } return f; } /** * Return a List as a String array * @param list * @return */ public static String[] toStringArray(final List<?> list) { final String[] f = new String[list.size()]; int i = 0; for (final Iterator<?> iter = list.iterator(); iter.hasNext(); i++) { f[i] = iter.next().toString(); } return f; } }