package net.pterodactylus.xdcc.ui.stdin;
+import static net.pterodactylus.xdcc.data.Download.BY_NAME;
+import static net.pterodactylus.xdcc.data.Download.BY_RUNNING;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import com.google.common.base.Predicate;
import com.google.common.collect.ComparisonChain;
+import com.google.common.collect.FluentIterable;
import com.google.common.collect.Lists;
+import com.google.common.collect.Ordering;
import com.google.common.collect.Sets;
import com.google.common.eventbus.Subscribe;
import com.google.common.primitives.Ints;
writeLine("End of Search.");
} else if (words[0].equalsIgnoreCase("dcc")) {
int counter = 0;
- for (Download download : core.downloads()) {
+ for (Download download : FluentIterable.from(core.downloads()).toSortedList(Ordering.from(BY_NAME).compound(BY_RUNNING))) {
DccReceiver dccReceiver = download.dccReceiver();
if (dccReceiver == null) {
/* download has not even started. */