Java List from Array asList(String strList, String regex)

Here you can find the source of asList(String strList, String regex)

Description

as List

License

Apache License

Declaration

public static List<String> asList(String strList, String regex) 

Method Source Code

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

import java.util.ArrayList;

import java.util.List;

public class Main {

    public static List<String> asList(String strList, String regex) {
        List<String> list = new ArrayList<String>();
        if (null == strList || strList.isEmpty()) {
            return null;
        } else {//from   w w w  . j  a v  a2 s  .  co m
            String[] strLists = strList.split(regex);
            for (String str : strLists) {
                list.add(str);
            }
        }
        return list;
    }
}

Related

  1. asList(Object[] array)
  2. asList(Set set)
  3. asList(String data)
  4. asList(String str)
  5. asList(String string)
  6. asList(String val)
  7. asList(String valuesSeparatedBy, String delimiter)
  8. asList(String... args)
  9. asList(String... strings)