ctongfei / progressbar

Terminal-based progress bar for Java / JVM
http://tongfei.me/progressbar/
MIT License
1.07k stars 102 forks source link

Pass size when wrapping array with ProgressBarBuilder #101

Closed seanf closed 3 years ago

seanf commented 3 years ago

When wrapping an array and customising the ProgressBar with a ProgressBarBuilder, the size of the array is not used. This change brings arrays in line with Iterable and Spliterator, which do use the size when known.

seanf commented 3 years ago

Another option would be to expose ProgressBarBuilder.getInitialMax(), and only call setInitialMax() if the current value is still -1. For consistency, this could be done for Iterable and Spliterator too.

ctongfei commented 3 years ago

Thanks @seanf ! This is excellent. This will be released in the next version.