Class JNIArrayIterator

java.lang.Object
dev.vortex.jni.JNIArrayIterator
All Implemented Interfaces:
ArrayIterator, AutoCloseable, Iterator<Array>

public final class JNIArrayIterator extends Object implements ArrayIterator
  • Constructor Details

    • JNIArrayIterator

      public JNIArrayIterator(long pointer)
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<Array>
    • next

      public Array next()
      Specified by:
      next in interface Iterator<Array>
    • getDataType

      public DType getDataType()
      Description copied from interface: ArrayIterator
      Returns the data type of the arrays that this iterator produces.

      This method provides type information about the arrays that will be returned by subsequent calls to Iterator.next(). The data type remains constant throughout the lifetime of the iterator and can be used for type-safe processing and validation.

      Specified by:
      getDataType in interface ArrayIterator
      Returns:
      the DType representing the data type of arrays produced by this iterator
    • close

      public void close()
      Description copied from interface: ArrayIterator
      Closes this iterator and releases any underlying resources.

      This method should be called when the iterator is no longer needed to ensure proper cleanup of any native resources or memory allocations. After calling this method, the iterator should not be used for further operations.

      It is recommended to use this iterator within a try-with-resources statement to ensure automatic cleanup:

      
       try (ArrayIterator iterator = array.getIterator()) {
           // Use iterator
       } // close() is called automatically
       

      This method overrides AutoCloseable.close() and does not throw any checked exceptions, making it safe to use in any context.

      Specified by:
      close in interface ArrayIterator
      Specified by:
      close in interface AutoCloseable
      See Also: