public static StreamEx<String> split(CharSequence str,Pattern pattern){
  if (str.length() == 0)   return of("");
  return of(UnknownSizeSpliterator.optimize(pattern.splitAsStream(str)));
}

public static StreamEx < String > split ( CharSequence str , Pattern pattern ) { if ( str . length ( ) == 0 ) return of ( "" ) ; return of ( UnknownSizeSpliterator . optimize ( pattern . splitAsStream ( str ) ) ) ; }
creates a stream from the given input sequence around matches of the given pattern . < p > the stream returned by this method contains each substring of the input sequence that is terminated by another subsequence that matches this pattern or is terminated by the end of the input sequence . the substrings in the stream are in the order in which they occur in the input . trailing empty strings will be discarded and not encountered in the stream . < p > if the given pattern does not match any subsequence of the input then the resulting stream has just one element , namely the input sequence in string form . < p > when there is a positive - width match at the beginning of the input sequence then an empty leading substring is included at the beginning of the stream . a zero - width match at the beginning however never produces such empty leading substring . < p > if the input sequence is mutable , it must remain constant from the stream creation until the execution of the terminal stream operation . otherwise , the result of the terminal stream operation is undefined .
