diff options
| -rw-r--r-- | src/main/java/com/it_jaros/jscanner/ProgressBar.java | 7 |
1 files 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 index 7c73057..12a359c 100644 --- 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); } |
