Class CloseableIterator.Wrapper<T>

  • All Implemented Interfaces:
    io.vavr.collection.Foldable<T>, io.vavr.collection.Iterator<T>, io.vavr.collection.Traversable<T>, io.vavr.Value<T>, AutoCloseable, Iterable<T>, Iterator<T>, CloseableIterator<T>
    Enclosing interface:
    CloseableIterator<T>

    public static class CloseableIterator.Wrapper<T>
    extends Object
    implements CloseableIterator<T>
    A wrapper which takes a plain iterator and turns it into a closeable one. A list of closeable resources can be supplied: when this iterator is closed, all those closeables will be closed as well.
    • Constructor Summary

      Constructors 
      Constructor Description
      Wrapper​(io.vavr.collection.Iterator<T> iterator, io.vavr.collection.List<AutoCloseable> toClose)
      Wraps a plain iterator, supplying a list of closeables to be closed when the resulting CloseableIterator is closed.
      Wrapper​(io.vavr.collection.Iterator<T> iterator, AutoCloseable toClose)
      Convenience constructor when there is only one underlying closeable.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Releases all resources underpinning this iterator.
      boolean hasNext()
      Checks if the iterator contains a next element.
      T next()
      Returns the next element in the stream if there is one available.
      • Methods inherited from interface io.vavr.collection.Foldable

        fold, reduce, reduceOption
      • Methods inherited from interface io.vavr.collection.Iterator

        concat, findLast, foldRight, get, groupBy, hasDefiniteSize, head, initOption, isAsync, isEmpty, isLazy, isSequential, isTraversableAgain, last, length, partition, reduceLeft, reduceRight, scan, span, stringPrefix, tailOption, transform, unzip, unzip3
      • Methods inherited from interface io.vavr.collection.Traversable

        arrangeBy, average, containsAll, count, equals, existsUnique, find, foldLeft, forEachWithIndex, hashCode, headOption, isDistinct, isOrdered, isSingleValued, lastOption, max, maxBy, maxBy, min, minBy, minBy, mkCharSeq, mkCharSeq, mkCharSeq, mkString, mkString, mkString, nonEmpty, product, reduceLeftOption, reduceRightOption, single, singleOption, size, spliterator, sum
      • Methods inherited from interface io.vavr.Value

        collect, collect, contains, corresponds, eq, exists, forAll, forEach, getOrElse, getOrElse, getOrElseThrow, getOrElseTry, getOrNull, out, out, stderr, stdout, toArray, toCharSeq, toCompletableFuture, toEither, toEither, toInvalid, toInvalid, toJavaArray, toJavaArray, toJavaArray, toJavaCollection, toJavaList, toJavaList, toJavaMap, toJavaMap, toJavaMap, toJavaOptional, toJavaParallelStream, toJavaSet, toJavaSet, toJavaStream, toLeft, toLeft, toLinkedMap, toLinkedMap, toLinkedSet, toList, toMap, toMap, toOption, toPriorityQueue, toPriorityQueue, toQueue, toRight, toRight, toSet, toSortedMap, toSortedMap, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toStream, toString, toTree, toTree, toTry, toTry, toValid, toValid, toValidation, toValidation, toVector
    • Constructor Detail

      • Wrapper

        public Wrapper​(io.vavr.collection.Iterator<T> iterator,
                       io.vavr.collection.List<AutoCloseable> toClose)
        Wraps a plain iterator, supplying a list of closeables to be closed when the resulting CloseableIterator is closed.
      • Wrapper

        public Wrapper​(io.vavr.collection.Iterator<T> iterator,
                       AutoCloseable toClose)
        Convenience constructor when there is only one underlying closeable.