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)
| 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 |