Java String to List stringToList(String s)

Here you can find the source of stringToList(String s)

Description

string To List

License

Apache License

Declaration

public static List<String> stringToList(String s) 

Method Source Code


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

import java.util.Arrays;

import java.util.List;

public class Main {
    public static List<String> stringToList(String s) {
        return Arrays.asList(splitOnSpaces(s));
    }/* w  w  w  .  j  av a  2s  .  c o  m*/

    public static String[] splitOnSpaces(String s) {
        if ("".equals(s)) {
            return new String[0];
        }
        return s.split("[ ]+");
    }
}

Related

  1. stringToList(String listString, String delimiter)
  2. stringToList(String listText)
  3. StringToList(String listText, String regex)
  4. stringToList(String s)
  5. stringToList(String s)
  6. stringToList(String source)
  7. stringToList(String sText)
  8. stringToList(String str)
  9. stringToList(String str)