Class RandomAccessScanner<T>

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

public class RandomAccessScanner<T>
extends Object
implements Scanner<T>
Avoid an intermediate Iterator when scanning a List with RandomAccess layout.
  • Constructor Details

  • Method Details

    • of

      public static <T> Scanner<T> of​(List<T> list)
      Description copied from interface: Scanner
      Convert an Object into a Scanner.
      Parameters:
      list - 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