Java List to Array toStringArray(List l)

Here you can find the source of toStringArray(List l)

Description

_more_

License

Open Source License

Parameter

Parameter Description
l _more_

Return

_more_

Declaration

public static String[] toStringArray(List l) 

Method Source Code

//package com.java2s;
/*/*from w ww. j a  v a2  s .c  om*/
 * Copyright (c) 2008-2015 Geode Systems LLC
 * This Software is licensed under the Geode Systems RAMADDA License available in the source distribution in the file 
 * ramadda_license.txt. The above copyright notice shall be included in all copies or substantial portions of the Software.
 */

import java.util.List;

public class Main {
    /**
     * _more_
     *
     * @param l _more_
     *
     * @return _more_
     */
    public static String[] toStringArray(List l) {
        String[] a = new String[l.size()];
        for (int i = 0; i < l.size(); i++) {
            Object o = l.get(i);
            if (o == null) {
                a[i] = null;
            } else {
                a[i] = o.toString();
            }
        }

        return a;
    }

    /**
     * _more_
     *
     * @param o _more_
     *
     * @return _more_
     */
    public static String toString(Object o) {
        if (o == null) {
            return "";
        }

        return o.toString();
    }
}

Related

  1. toObjectArray(List list)
  2. toObjectArray(List list)
  3. toObjectArrayNative(List L)
  4. toStringArray(final List stringList)
  5. toStringArray(final List list)
  6. toStringArray(List list)
  7. toStringArray(List list)
  8. toStringArray(List objList)
  9. toStringArray(List array)

  10. HOME | Copyright © www.java2s.com 2016