Class ProgressIterable<E>
- Type Parameters:
- E- Type of elements to be iterated over.
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- Iterable<E>,- MappableIterable<E>
Iterable wrapper that will start a ProgressBar for each
 iterator.
 
 As items are obtained by calling next() the
 ProgressBar is updated. When hasNext()
 returns false the ProgressBar is closed resulting in the duration to be
 written out. If the Iterable is used in a for loop the duration is started at
 the beginning of the for loop and duration finishes and reports as the for
 loop ends. (Not at the time the last element is provided.)
 
 Calling iterator() more than once is supported but could result in
 mixed output if they are run at the same time.
- Author:
- Christian-B
- 
Constructor SummaryConstructorsConstructorDescriptionProgressIterable(Collection<E> things, String description) Creates an iterable wrapper but not yet a ProgressBar.ProgressIterable(Collection<E> things, String description, PrintStream output) Creates an iterable wrapper but not yet a ProgressBar.
- 
Method SummaryMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliteratorMethods inherited from interface uk.ac.manchester.spinnaker.utils.MappableIterablefilter, first, first, map, nth, toCollectingMap, toCollectingMap, toCollectingMap, toCollectingMap, toList, toList, toMap, toMap, toSet, toSet
- 
Constructor Details- 
ProgressIterableCreates an iterable wrapper but not yet a ProgressBar.- Parameters:
- things- A collection to supply a size and and iterable. The type of elements returned by this iterable is also the type of elements returned by the ProgressIterable.
- description- A text description to add at the start and when reporting duration.
- output- The Stream to write output too. For example,- System.out.
 
- 
ProgressIterableCreates an iterable wrapper but not yet a ProgressBar. The progress bar will write toSystem.out.- Parameters:
- things- A collection to supply a size and and iterable. The type of elements returned by this iterable is also the type of elements returned by the ProgressIterable.
- description- A text description to add at the start and when reporting duration.
 
 
- 
- 
Method Details- 
iteratorStarts a ProgressBar and returns an iterator over the elements of the iterable contained within this iterable.
- 
closepublic void close()Closes all created Iterators and their ProgressBar(s).This method allows the Iterable to be used in a try-with-resources statement, which guarantees the ProgressBar is closed.Note: As hasNext() == falseautomatically calls close there is no need to call this method unless you break out of the iterator early.If the bar is already closed, invoking this method has no effect. - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
 
-