Class CloseableIteratorAdapter<T>

  • Type Parameters:
    T - The type being iterated (usually ResourceObject)
    All Implemented Interfaces:
    AutoCloseable, Iterator<T>, sailpoint.tools.CloseableIterator<T>

    public class CloseableIteratorAdapter<T>
    extends Object
    implements Iterator<T>, sailpoint.tools.CloseableIterator<T>, AutoCloseable
    A wrapper class for IIQ’s CloseableIterator that still implements CloseableIterator, but also implement the broader Iterator and AutoClosable interfaces to allow regular Java stuff to interact with it.
    • Constructor Detail

      • CloseableIteratorAdapter

        public CloseableIteratorAdapter​(sailpoint.tools.CloseableIterator<T> iterator)
        Construct a new iterator wrapper.
        Parameters:
        iterator - The iterator to wrap. If null is provided, a NullCloseableIterator is substituted
    • Method Detail

      • close

        public void close()
        Invokes close on the wrapped iterator
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface sailpoint.tools.CloseableIterator<T>
      • hasNext

        public boolean hasNext()
        Returns true if the wrapped iterator’s hasNext() returns true
        Specified by:
        hasNext in interface sailpoint.tools.CloseableIterator<T>
        Specified by:
        hasNext in interface Iterator<T>
        Returns:
        True if the iterator has more elements
      • next

        public T next()
        Returns the next element from the iterator
        Specified by:
        next in interface sailpoint.tools.CloseableIterator<T>
        Specified by:
        next in interface Iterator<T>
        Returns:
        The next element from the iterator
        Throws:
        NoSuchElementException - if the wrapped iterator was null or is exhausted