Class ResourceClosingIterator<T,V>

java.lang.Object
apoc.util.collection.ResourceClosingIterator<T,V>
All Implemented Interfaces:
AutoCloseable, Iterator<V>, org.neo4j.graphdb.Resource, org.neo4j.graphdb.ResourceIterator<V>

public abstract class ResourceClosingIterator<T,V> extends Object implements org.neo4j.graphdb.ResourceIterator<V>
  • Field Summary

    Fields inherited from interface org.neo4j.graphdb.Resource

    EMPTY
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    static <R> org.neo4j.graphdb.ResourceIterator<R>
    fromResourceIterable(org.neo4j.graphdb.ResourceIterable<R> iterable)
    Return a ResourceIterator for the provided iterable that will also close this iterable when the returned iterator is itself closed.
    boolean
     
    abstract V
    map(T elem)
     
    static <R> org.neo4j.graphdb.ResourceIterator<R>
    newResourceIterator(Iterator<R> iterator, org.neo4j.graphdb.Resource... resources)
     
     
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.Iterator

    forEachRemaining

    Methods inherited from interface org.neo4j.graphdb.ResourceIterator

    map, stream
  • Method Details

    • newResourceIterator

      public static <R> org.neo4j.graphdb.ResourceIterator<R> newResourceIterator(Iterator<R> iterator, org.neo4j.graphdb.Resource... resources)
    • fromResourceIterable

      public static <R> org.neo4j.graphdb.ResourceIterator<R> fromResourceIterable(org.neo4j.graphdb.ResourceIterable<R> iterable)
      Return a ResourceIterator for the provided iterable that will also close this iterable when the returned iterator is itself closed. Please note, it is much preferred to explicitly close the ResourceIterable but this utility provides a way of cleaning up resources when the iterable is never exposed to client code; for example when the ResourceIterator is the return-type of a method call.
      Type Parameters:
      R - the type of elements in the given iterable
      Parameters:
      iterable - the iterable to provider the iterator
      Returns:
      the iterator for the provided iterable
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface org.neo4j.graphdb.Resource
      Specified by:
      close in interface org.neo4j.graphdb.ResourceIterator<T>
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<T>
    • map

      public abstract V map(T elem)
    • next

      public V next()
      Specified by:
      next in interface Iterator<T>
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<T>