Java Collection to Array toStringArray(Collection items)

Here you can find the source of toStringArray(Collection items)

Description

Convert a collection of strings into a string array.

License

Open Source License

Parameter

Parameter Description
items a parameter

Declaration

public static String[] toStringArray(Collection<String> items) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

public class Main {
    /**//from   ww  w  .j  a v  a 2 s  . c o  m
     * Convert a collection of strings into a string array.
     *
     * @param items
     * @return
     */
    public static String[] toStringArray(Collection<String> items) {
        String[] result = new String[items.size()];
        int i = 0;
        for (String s : items) {
            result[i++] = s;
        }
        return result;
    }
}

Related

  1. toStringArray(Collection collection)
  2. toStringArray(Collection collection)
  3. toStringArray(Collection collection)
  4. toStringArray(Collection collection)
  5. toStringArray(Collection collection)
  6. toStringArray(Collection list)
  7. toStringArray(Collection strings)
  8. toStringArray(final Collection fields)
  9. toStringArray(final Collection collection)