Java List from Array asList(String valuesSeparatedBy, String delimiter)

Here you can find the source of asList(String valuesSeparatedBy, String delimiter)

Description

as List

License

LGPL

Declaration

public static ArrayList<String> asList(String valuesSeparatedBy, String delimiter) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.util.ArrayList;

public class Main {
    public static ArrayList<String> asList(String valuesSeparatedBy, String delimiter) {
        ArrayList<String> retVal = new ArrayList<String>();
        String[] pieces = valuesSeparatedBy.split(delimiter);
        for (String piece : pieces) {
            retVal.add(piece.trim());/*from   w ww. j av  a 2  s. c  o  m*/
        }
        return retVal;
    }
}

Related

  1. asList(String data)
  2. asList(String str)
  3. asList(String string)
  4. asList(String strList, String regex)
  5. asList(String val)
  6. asList(String... args)
  7. asList(String... strings)
  8. asList(T element)
  9. asList(T firstItem, T... otherItems)