Class ArrayScanner<T>

java.lang.Object
io.datarouter.scanner.ArrayScanner<T>
All Implemented Interfaces:
Scanner<T>, Closeable, AutoCloseable

public class ArrayScanner<T> extends Object implements Scanner<T>
  • Constructor Details

    • ArrayScanner

      public ArrayScanner(T[] array)
  • Method Details

    • of

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

      public boolean advance()
      Description copied from interface: Scanner
      Try to update current to the next item, if there is one.
      Specified by:
      advance in interface Scanner<T>
      Returns:
      True if it advanced
    • current

      public T current()
      Specified by:
      current in interface Scanner<T>
      Returns:
      The current item, only valid if advance() returned true