Java Comma Separated List commaDelimitedStringToList(String str)

Here you can find the source of commaDelimitedStringToList(String str)

Description

comma Delimited String To List

License

Open Source License

Declaration

public static List<String> commaDelimitedStringToList(String str) 

Method Source Code


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

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List<String> commaDelimitedStringToList(String str) {
        if (str == null || str.length() == 0) {
            return new ArrayList<String>(0);
        }//from   www  .j  av  a 2s .  c  o  m
        List<String> result = new ArrayList<String>();

        String[] pieces = str.split(",");
        for (String piece : pieces) {
            result.add(piece);
        }
        return result;
    }
}

Related

  1. commaDelimitedListToStringArray(final String str)
  2. commaDelimitedListToStringArray(String str)
  3. commaDelimitedListToStringArray(String str)
  4. commaDelimitedListToStringArray(String str)
  5. commaDelimitedListToStringArray(String str)
  6. commaDelimitedToList(String commaDelimited)
  7. commalist(List l)
  8. commalist(List l)
  9. commandToString(List args)