Here you can find the source of split(final String regex, final String value)
Parameter | Description |
---|---|
regex | a parameter |
value | a parameter |
public static Collection<String> split(final String regex, final String value)
//package com.java2s; import java.util.*; public class Main { /**/* w w w .ja v a 2 s. co m*/ * @param regex * @param value * @return */ public static Collection<String> split(final String regex, final String value) { return split(regex, value, new LinkedList<String>()); } /** * @param <T> * @param regex * @param value * @param l * @return */ public static <T extends Collection<String>> T split(final String regex, final String value, final T l) { final String[] bits = value.split(regex); for (final String bit : bits) { l.add(bit); } return l; } /** * Add objects to a collection... mostly used when an object instantiation is in the first paramter. */ public static <T extends Object, C extends Collection<? super T>> C add(final C cxn, final T... objs) { if (objs != null) { for (final T obj : objs) { cxn.add(obj); } } return cxn; } public static <T extends Object, C extends Collection<? super T>> C add(final C cxn, Iterable<T> from) { if (from != null) { for (T obj : from) { cxn.add(obj); } } return cxn; } }