Java String to List stringToList(String content)

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

Description

string To List

License

Apache License

Declaration

public static List<String> stringToList(String content) 

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> stringToList(String content) {
        if (content == null) {
            return new ArrayList<String>();
        }/*w  w  w  .  j a  v  a  2s .c o m*/
        content = content.replace("\r", "");
        String[] listArray = content.split("\n");

        List<String> returnList = new ArrayList<String>();
        for (String element : listArray) {
            returnList.add(element);
        }

        return returnList;
    }
}

Related

  1. stringToArrayList(String idString)
  2. stringToBooleanList(final String str, final boolean[] listData)
  3. stringToIntegerList(String input)
  4. stringToItems(List fontsList, boolean useSeparator)
  5. stringToList(final String string)
  6. stringToList(String content, String splitter)
  7. stringToList(String delimitedString)
  8. stringToList(String input)
  9. stringToList(String keywords, String delimiter)