Since version 0.7.0, you can use the builder pattern to configure a ProgressBar instead of using standard constructors. This allows for fine-grained control over the visual style, units, task names, and update frequency. All configuration methods are optional.
To use the builder, call ProgressBar.builder() and chain the desired configuration methods. Once configured, pass the builder instance to ProgressBar.wrap(collection, pbb) to wrap an iterable collection with the progress bar.
ProgressBarBuilder pbb = ProgressBar.builder()
.setInitialMax(<initial max>)
.setStyle(ProgressBarStyle.<style>)
.setTaskName(<taskName name>)
.setUnit(<unit name>, <unit size>)
.setUpdateIntervalMillis(<update interval>)
.setMaxRenderedLength(<max rendered length in terminal>)
.showSpeed()
// or .showSpeed(new DecimalFormat("#.##")) to customize speed display
.setEtaFunction(state -> ...)
// This function is of type `ProgressState -> Optional<Duration>`
// that should output the estimated ETA of the progress.
// Returning `Optional.empty()` means that ETA is not available.
for (T x : ProgressBar.wrap(collection, pbb)) {
...
}