From 7be44370f6828c540ee3bcc7789b181aafadbbf4 Mon Sep 17 00:00:00 2001 From: mr-intj Date: Mon, 30 Apr 2018 14:44:13 -0700 Subject: * Using Camel Case for methods * Use braces on single-line blocks --- .../java/de/danoeh/antennapod/core/util/QueueSorter.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/QueueSorter.java b/core/src/main/java/de/danoeh/antennapod/core/util/QueueSorter.java index 40b5bc24d..5c827dfe9 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/QueueSorter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/QueueSorter.java @@ -81,10 +81,10 @@ public class QueueSorter { permutor = Collections::shuffle; break; case SMART_SHUFFLE_ASC: - permutor = (queue) -> SmartShuffle(queue, true); + permutor = (queue) -> smartShuffle(queue, true); break; case SMART_SHUFFLE_DESC: - permutor = (queue) -> SmartShuffle(queue, false); + permutor = (queue) -> smartShuffle(queue, false); break; default: } @@ -131,7 +131,7 @@ public class QueueSorter { * @param ascending {@code true} to use ascending pubdate in the reordering; * {@code false} for descending. */ - private static void SmartShuffle(List queue, boolean ascending) { + private static void smartShuffle(List queue, boolean ascending) { // Divide FeedItems into lists by feed @@ -140,8 +140,9 @@ public class QueueSorter { while (!queue.isEmpty()) { FeedItem item = queue.remove(0); Long id = item.getFeedId(); - if (!map.containsKey(id)) + if (!map.containsKey(id)) { map.put(id, new ArrayList<>()); + } map.get(id).add(item); } @@ -151,8 +152,9 @@ public class QueueSorter { ? (f1, f2) -> f1.getPubDate().compareTo(f2.getPubDate()) : (f1, f2) -> f2.getPubDate().compareTo(f1.getPubDate()); - for (Long id : map.keySet()) + for (Long id : map.keySet()) { Collections.sort(map.get(id), itemComparator); + } // Create a list of the individual FeedItems lists, and sort it by feed title (ascending). // Doing this ensures that the feed order we use is predictable/deterministic. @@ -174,8 +176,9 @@ public class QueueSorter { queue.add(items.remove(0)); // Removed the last item in this particular feed? Then remove this feed from the // list of feeds. - if (items.isEmpty()) + if (items.isEmpty()) { feeds.remove(i); + } } } } -- cgit v1.2.3