List of usage examples for java.util List toArray
<T> T[] toArray(T[] a);
From source file:Main.java
@Nullable public static String[] nullableArrayOfStrings(@Nullable List<String> list) { return list == null || list.isEmpty() ? null : list.toArray(new String[list.size()]); }
From source file:Main.java
public static int[] toIntArray(List<Integer> list) { return toPrimitive(list.toArray(new Integer[0])); }
From source file:Main.java
static public <T> CompletableFuture<List<T>> all(List<CompletableFuture<T>> cf) { return CompletableFuture.allOf(cf.toArray(new CompletableFuture[cf.size()])) .thenApply(v -> cf.stream().map(CompletableFuture::join).collect(toList())); }
From source file:Main.java
@SuppressWarnings("unchecked") public static <T> T[] intersect(Class<T> arrayType, T[] first, T[] second) { List<T> result = intersect(first, second); return result.toArray((T[]) Array.newInstance(arrayType, result.size())); }
From source file:co.mafiagame.common.utils.ListToString.java
public static String toString(List<String> source) { return StringUtils.arrayToDelimitedString(source.toArray(new String[source.size()]), " "); }
From source file:Main.java
public static String[] toStrArray(final List<String> arrList) { final String[] r = new String[arrList.size()]; arrList.toArray(r); return r;/*from w w w . java 2s .c om*/ }
From source file:Main.java
public static List<Element> getChildrenWithTag(Element parent, String tag) { List<Element> list = getElementChildren(parent); for (Element e : list.toArray(new Element[0])) { if (!e.getTagName().equals(tag)) list.remove(e);//from www. j av a2 s . c o m } return list; }
From source file:dtu.ds.warnme.app.ws.client.restful.utils.RestUtils.java
public static Header[] getHeadersAsArray(List<Header> headers) { return headers.toArray(new Header[headers.size()]); }
From source file:Main.java
public static String[] getStringsFormat(List<String> mapValuesList) { final String[] arr = new String[mapValuesList.size()]; mapValuesList.toArray(arr); Arrays.sort(arr);/*from w ww . j a v a 2 s .c o m*/ return arr; }
From source file:Main.java
/** * Copy the given Enumeration into a String array. * The Enumeration must contain String elements only. * @param enumeration the Enumeration to copy * @return the String array ({@code null} if the passed-in * Enumeration was {@code null})//ww w . j a v a 2 s.com */ public static String[] toStringArray(Enumeration<String> enumeration) { if (enumeration == null) { return null; } List<String> list = Collections.list(enumeration); return list.toArray(new String[list.size()]); }