Java Collection to String asStringArr(Collection collection)

Here you can find the source of asStringArr(Collection collection)

Description

as String Arr

License

Open Source License

Declaration

public static String[] asStringArr(Collection<?> collection) 

Method Source Code

//package com.java2s;
/*//from w w  w  . j  a va  2  s .  com
 * Copyright (C) ${year} Omry Yadan <${email}>
 * All rights reserved.
 *
 * See https://github.com/omry/banana/blob/master/BSD-LICENSE for licensing information
 */

import java.util.*;

public class Main {
    public static String[] asStringArr(Collection<?> collection) {
        String res[] = new String[collection.size()];
        int i = 0;
        for (Object s : collection) {
            res[i++] = String.valueOf(s);
        }
        return res;
    }
}

Related

  1. asString(Collection c, String separator)
  2. asString(Collection collection)
  3. asStringArray(Collection coll)
  4. asStringArray(Collection collection)
  5. buildString(Collection args, String seperator, int startingArg, int maxLength)
  6. buildString(Collection keys)