Java String to List convertToList(String[] array)

Here you can find the source of convertToList(String[] array)

Description

A method to convert a String array to a List of Strings

License

Open Source License

Parameter

Parameter Description
array The string array to convert

Return

A ArrayList containing the array elements

Declaration

public static List<String> convertToList(String[] array) 

Method Source Code


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

import java.util.ArrayList;
import java.util.Collections;

import java.util.List;

public class Main {
    /**//from  w  w w.j  ava2s  .c o m
     * A method to convert a String array to a List of Strings
     *
     * @param array The string array to convert
     * @return A ArrayList containing the array elements
     */
    public static List<String> convertToList(String[] array) {
        ArrayList<String> list = new ArrayList<String>();
        Collections.addAll(list, array);
        return list;
    }
}

Related

  1. convertTextToStringList(String text)
  2. convertToList(String inputString)
  3. convertToList(String str)
  4. convertToList(String string, String delim)
  5. convertToList(String vars)
  6. stringsToList(final String[] src)
  7. stringToArrayList(String idString)
  8. stringToBooleanList(final String str, final boolean[] listData)
  9. stringToIntegerList(String input)