Here you can find the source of toStreamLine(final Scanner scanner)
public static Stream<String> toStreamLine(final Scanner scanner)
//package com.java2s; import java.util.Iterator; import java.util.Objects; import java.util.Scanner; import java.util.Spliterator; import java.util.Spliterators; import java.util.stream.Stream; import java.util.stream.StreamSupport; public class Main { public static Stream<String> toStreamLine(final Scanner scanner) { Objects.requireNonNull(scanner); final Iterator<String> iter = new Iterator<String>() { final Scanner s = scanner; @Override/*from w ww .j a va 2s . co m*/ public boolean hasNext() { return s.hasNextLine(); } @Override public String next() { return s.nextLine(); } }; return StreamSupport.stream( Spliterators.spliteratorUnknownSize(iter, Spliterator.ORDERED | Spliterator.NONNULL), false); } }