< prev index next >

jdk/src/java.base/share/classes/java/util/Scanner.java

Print this page

        

*** 2682,2692 **** * <p>The resulting list would contain {@code "abc"}, {@code "def"}, * the empty string, and {@code "ghi"}. * * @return a sequential stream of token strings * @throws IllegalStateException if this scanner is closed ! * @since 1.9 */ public Stream<String> tokens() { ensureOpen(); Stream<String> stream = StreamSupport.stream(new TokenSpliterator(), false); return stream.onClose(this::close); --- 2682,2692 ---- * <p>The resulting list would contain {@code "abc"}, {@code "def"}, * the empty string, and {@code "ghi"}. * * @return a sequential stream of token strings * @throws IllegalStateException if this scanner is closed ! * @since 9 */ public Stream<String> tokens() { ensureOpen(); Stream<String> stream = StreamSupport.stream(new TokenSpliterator(), false); return stream.onClose(this::close);
*** 2768,2778 **** * * @param pattern the pattern to be matched * @return a sequential stream of match results * @throws NullPointerException if pattern is null * @throws IllegalStateException if this scanner is closed ! * @since 1.9 */ public Stream<MatchResult> findAll(Pattern pattern) { Objects.requireNonNull(pattern); ensureOpen(); Stream<MatchResult> stream = StreamSupport.stream(new FindSpliterator(pattern), false); --- 2768,2778 ---- * * @param pattern the pattern to be matched * @return a sequential stream of match results * @throws NullPointerException if pattern is null * @throws IllegalStateException if this scanner is closed ! * @since 9 */ public Stream<MatchResult> findAll(Pattern pattern) { Objects.requireNonNull(pattern); ensureOpen(); Stream<MatchResult> stream = StreamSupport.stream(new FindSpliterator(pattern), false);
*** 2790,2800 **** * @param patString the pattern string * @return a sequential stream of match results * @throws NullPointerException if patString is null * @throws IllegalStateException if this scanner is closed * @throws PatternSyntaxException if the regular expression's syntax is invalid ! * @since 1.9 * @see java.util.regex.Pattern */ public Stream<MatchResult> findAll(String patString) { Objects.requireNonNull(patString); ensureOpen(); --- 2790,2800 ---- * @param patString the pattern string * @return a sequential stream of match results * @throws NullPointerException if patString is null * @throws IllegalStateException if this scanner is closed * @throws PatternSyntaxException if the regular expression's syntax is invalid ! * @since 9 * @see java.util.regex.Pattern */ public Stream<MatchResult> findAll(String patString) { Objects.requireNonNull(patString); ensureOpen();
< prev index next >