MCPcopy
hub / github.com/google/guava / splitToList

Method splitToList

guava/src/com/google/common/base/Splitter.java:397–408  ·  view source on GitHub ↗

Splits {@code sequence} into string components and returns them as an immutable list. If you want an {@link Iterable} which may be lazily evaluated, use {@link #split(CharSequence)}. @param sequence the sequence of characters to split @return an immutable list of the segments split from the paramet

(CharSequence sequence)

Source from the content-addressed store, hash-verified

395 * @since 15.0
396 */
397 public List<String> splitToList(CharSequence sequence) {
398 checkNotNull(sequence);
399
400 Iterator<String> iterator = splittingIterator(sequence);
401 List<String> result = new ArrayList<>();
402
403 while (iterator.hasNext()) {
404 result.add(iterator.next());
405 }
406
407 return Collections.unmodifiableList(result);
408 }
409
410 /**
411 * Splits {@code sequence} into string components and makes them available through an {@link

Callers 1

Calls 5

splittingIteratorMethod · 0.95
addMethod · 0.65
nextMethod · 0.65
checkNotNullMethod · 0.45
hasNextMethod · 0.45

Tested by 1