Java Array to List toList(String[] arr)

Here you can find the source of toList(String[] arr)

Description

array to list

License

Open Source License

Parameter

Parameter Description
arr a parameter

Return

if arr is null return null

Declaration

public static List<String> toList(String[] arr) 

Method Source Code

//package com.java2s;

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**/* w  w w  .j  av  a2s  . c om*/
     * array to list
     *
     * @param arr
     * @return if arr is null return null
     */
    public static List<String> toList(String[] arr) {

        if (null == arr) {
            return null;
        }

        List<String> list = new ArrayList<String>();
        for (int i = 0; i < arr.length; i++) {
            list.add(arr[i]);
        }
        return list;
    }
}

Related

  1. toList(Object[] array)
  2. toList(Object[] array)
  3. toList(Object[] data)
  4. toList(Object[] input)
  5. toList(String[] anArray)
  6. toList(String[] array)
  7. toList(String[] array)
  8. toList(T element, T... elements)
  9. toList(T value)