jscanner

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit f1d72559e194ab6d361cf70dddfe95f013fb9613
parent f820d7d8715488b8b89291a17940429f0a2a3bda
Author: Matthias Jaros <jaros@mailbox.org>
Date:   Sat,  4 Jul 2026 14:20:23 +0200

Improved algorithm by sorting first and then removing all that are 100%
and break once we reach one that does not have that

Diffstat:
Msrc/main/java/com/it_jaros/jscanner/ProgressBar.java | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/it_jaros/jscanner/ProgressBar.java b/src/main/java/com/it_jaros/jscanner/ProgressBar.java @@ -61,17 +61,20 @@ public class ProgressBar { } private void drawProgress(boolean last) { + // sort -> the more progressed the host the more up it is + hosts.sort(Comparator.comparingInt((Progress p) -> p.done().get()).reversed()); + // find and print finished hosts one last time for (Iterator<Progress> it = hosts.iterator(); it.hasNext(); ) { Progress p = it.next(); if (p.done().get() == p.total()) { it.remove(); drawBar(p); + } else { + break; } } - // the more progressed the host the more up it is - hosts.sort(Comparator.comparingInt((Progress p) -> p.done().get()).reversed()); for (Progress progress : hosts) { drawBar(progress); }