Class StreamScanner<T>

All Implemented Interfaces:
Scanner<T>, Closeable, AutoCloseable

public class StreamScanner<T> extends IteratorScanner<T>
  • Constructor Details

    • StreamScanner

      public StreamScanner(Stream<T> stream)
  • Method Details

    • of

      public static <T> Scanner<T> of(Stream<T> stream)
      Description copied from interface: Scanner
      Convert an Object into a Scanner.
      Parameters:
      stream - A non-null Object
      Returns:
      A single-item Scanner with the Object
    • close

      public void close()
      Description copied from interface: Scanner
      Override to cleanup any resources. The call should be propagated to all parent scanners. In the infrequent case of calling advance/current in an application, the Scanner should be explicitly closed. Because the included Scanner operations will close themselves when they fail to advance, it frequently a no-op for the application, unless closing the scanner before it stops advancing.