diff --git a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/EntityRendererFactory.java b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/EntityRendererFactory.java index fe454f7..a12dc71 100644 --- a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/EntityRendererFactory.java +++ b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/EntityRendererFactory.java @@ -8,12 +8,14 @@ import java.awt.geom.Ellipse2D; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; +import java.util.AbstractMap.SimpleEntry; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Optional; import java.util.Random; import java.util.Set; @@ -78,8 +80,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.LinkedHashMultiset; import com.google.common.collect.Multiset; -import javafx.util.Pair; - public class EntityRendererFactory { private static List defaultProperties = ImmutableList.of("animation", "off_animation", "structure"); @@ -384,11 +384,12 @@ public class EntityRendererFactory { } if (!map.hasWire(key)) { - map.setWire(key, new Pair<>(getWirePositionFor(entity, prototype, colorName, circuitId), - new Point2D.Double())); + map.setWire(key, + new SimpleEntry<>(getWirePositionFor(entity, prototype, colorName, circuitId), + new Point2D.Double())); } else { - Pair pair = map.getWire(key); + Entry pair = map.getWire(key); Point2D.Double p1 = pair.getKey(); Point2D.Double p2 = pair.getValue(); diff --git a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/FBSR.java b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/FBSR.java index 4063917..a74899d 100644 --- a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/FBSR.java +++ b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/FBSR.java @@ -19,6 +19,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.util.AbstractMap.SimpleEntry; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collection; @@ -58,8 +59,6 @@ import com.google.common.collect.LinkedHashMultiset; import com.google.common.collect.Multiset; import com.google.common.collect.Table; -import javafx.util.Pair; - public class FBSR { private static class EntityRenderingTuple { @@ -780,14 +779,14 @@ public class FBSR { private static void populateTransitLogistics(WorldMap map) { Table logisticGrid = map.getLogisticGrid(); - ArrayDeque> work = new ArrayDeque<>(); + ArrayDeque> work = new ArrayDeque<>(); logisticGrid.cellSet().stream().filter(c -> c.getValue().isTransitStart()).forEach(c -> { Set outputs = c.getValue().getOutputs().get(); for (String item : outputs) { - work.add(new Pair<>(map.getLogisticCellPosition(c), c.getValue())); + work.add(new SimpleEntry<>(map.getLogisticCellPosition(c), c.getValue())); while (!work.isEmpty()) { - Pair pair = work.pop(); + Entry pair = work.pop(); Point2D.Double cellPos = pair.getKey(); LogisticGridCell cell = pair.getValue(); if (cell.addTransit(item) && !cell.isBannedOutput(item)) { @@ -795,12 +794,12 @@ public class FBSR { Point2D.Double nextCellPos = d.offset(cellPos, 0.5); map.getLogisticGridCell(nextCellPos) .filter(nc -> !nc.isBlockTransit() && nc.acceptMoveFrom(d)) - .ifPresent(next -> work.add(new Pair<>(nextCellPos, next))); + .ifPresent(next -> work.add(new SimpleEntry<>(nextCellPos, next))); }); cell.getWarps().ifPresent(l -> { for (Point2D.Double p : l) { map.getLogisticGridCell(p).filter(nc -> !nc.isBlockTransit()) - .ifPresent(next -> work.add(new Pair<>(p, next))); + .ifPresent(next -> work.add(new SimpleEntry<>(p, next))); } }); } @@ -812,9 +811,9 @@ public class FBSR { logisticGrid.cellSet().stream().filter(c -> c.getValue().isTransitEnd()).forEach(c -> { Set inputs = c.getValue().getInputs().get(); for (String item : inputs) { - work.add(new Pair<>(map.getLogisticCellPosition(c), c.getValue())); + work.add(new SimpleEntry<>(map.getLogisticCellPosition(c), c.getValue())); while (!work.isEmpty()) { - Pair pair = work.pop(); + Entry pair = work.pop(); Point2D.Double cellPos = pair.getKey(); LogisticGridCell cell = pair.getValue(); if (cell.addTransit(item)) { @@ -822,13 +821,13 @@ public class FBSR { for (Direction d : l) { Point2D.Double nextCellPos = d.offset(cellPos, 0.5); map.getLogisticGridCell(nextCellPos).filter(nc -> !nc.isBlockTransit()) - .ifPresent(next -> work.add(new Pair<>(nextCellPos, next))); + .ifPresent(next -> work.add(new SimpleEntry<>(nextCellPos, next))); } }); cell.getWarpedFrom().ifPresent(l -> { for (Point2D.Double p : l) { map.getLogisticGridCell(p).filter(nc -> !nc.isBlockTransit()) - .ifPresent(next -> work.add(new Pair<>(p, next))); + .ifPresent(next -> work.add(new SimpleEntry<>(p, next))); } }); } @@ -1056,7 +1055,7 @@ public class FBSR { } private static void showRailLogistics(Consumer register, DataTable table, WorldMap map) { - for (Pair pair : map.getRailEdges()) { + for (Entry pair : map.getRailEdges()) { boolean input = pair.getKey().isInput() || pair.getValue().isInput(); boolean output = pair.getKey().isOutput() || pair.getValue().isOutput(); diff --git a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/TaskReporting.java b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/TaskReporting.java index 849605f..cf90e82 100644 --- a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/TaskReporting.java +++ b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/TaskReporting.java @@ -1,16 +1,16 @@ package com.demod.fbsr; import java.awt.Color; +import java.util.AbstractMap.SimpleEntry; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; +import java.util.Map.Entry; import java.util.Optional; import java.util.Set; import com.demod.fbsr.WorldMap.Debug; -import javafx.util.Pair; - public class TaskReporting { public static enum Level { INFO(Color.gray), WARN(Color.orange), ERROR(Color.red), DEBUG(Color.magenta); @@ -30,7 +30,7 @@ public class TaskReporting { private Optional context = Optional.empty(); private final List warnings = new ArrayList<>(); private final List exceptions = new ArrayList<>(); - private final List, String>> images = new ArrayList<>(); + private final List, String>> images = new ArrayList<>(); private final List downloads = new ArrayList<>(); private final List links = new ArrayList<>(); private final Set info = new LinkedHashSet<>(); @@ -48,7 +48,7 @@ public class TaskReporting { } public void addImage(Optional label, String url) { - images.add(new Pair<>(label, url)); + images.add(new SimpleEntry<>(label, url)); } public void addInfo(String info) { @@ -83,7 +83,7 @@ public class TaskReporting { return exceptions; } - public List, String>> getImages() { + public List, String>> getImages() { return images; } diff --git a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/WebUtils.java b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/WebUtils.java index 74913f0..5cecaa3 100644 --- a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/WebUtils.java +++ b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/WebUtils.java @@ -13,6 +13,7 @@ import java.net.URL; import java.net.URLConnection; import java.nio.charset.StandardCharsets; import java.util.List; +import java.util.Map.Entry; import java.util.Optional; import java.util.concurrent.TimeUnit; @@ -27,7 +28,6 @@ import com.demod.fbsr.app.BlueprintBotDiscordService; import com.demod.fbsr.app.ServiceFinder; import com.google.common.util.concurrent.Uninterruptibles; -import javafx.util.Pair; import net.dv8tion.jda.core.EmbedBuilder; import net.dv8tion.jda.core.entities.MessageEmbed; @@ -90,14 +90,14 @@ public final class WebUtils { return Utils.readJsonFromStream(new URL(url).openStream()); } - public static URL uploadToBundly(String title, String description, List> links) + public static URL uploadToBundly(String title, String description, List> links) throws IOException { JSONObject request = new JSONObject(); request.put("title", title); request.put("desc", description); JSONArray items = new JSONArray(); - for (Pair pair : links) { + for (Entry pair : links) { JSONObject item = new JSONObject(); item.put("url", pair.getKey().toString()); item.put("id", Long.toString(System.currentTimeMillis())); diff --git a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/WorldMap.java b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/WorldMap.java index c5ef256..e6781c0 100644 --- a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/WorldMap.java +++ b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/WorldMap.java @@ -2,6 +2,7 @@ package com.demod.fbsr; import java.awt.geom.Point2D; import java.awt.geom.Point2D.Double; +import java.util.AbstractMap.SimpleEntry; import java.util.ArrayList; import java.util.Collection; import java.util.LinkedHashMap; @@ -9,6 +10,7 @@ import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Optional; import java.util.Set; @@ -20,8 +22,6 @@ import com.google.common.collect.Multimap; import com.google.common.collect.Table; import com.google.common.collect.Table.Cell; -import javafx.util.Pair; - public class WorldMap { public static enum BeltBend { @@ -237,7 +237,7 @@ public class WorldMap { private final Table heatPipes = HashBasedTable.create(); private final Table walls = HashBasedTable.create(); private final Table gates = HashBasedTable.create(); - private final Table> undergroundBeltEndings = HashBasedTable.create(); + private final Table> undergroundBeltEndings = HashBasedTable.create(); private final Table> beaconed = HashBasedTable.create(); // Row: X*2 @@ -246,9 +246,9 @@ public class WorldMap { private final Table railNodes = HashBasedTable.create(); // Key: "eid1|cid1|eid2|cid2|color" - private final Map> wires = new LinkedHashMap<>(); + private final Map> wires = new LinkedHashMap<>(); - private final List> railEdges = new ArrayList<>(); + private final List> railEdges = new ArrayList<>(); private Debug debug = new Debug(); @@ -338,7 +338,7 @@ public class WorldMap { return ret; } - public List> getRailEdges() { + public List> getRailEdges() { return railEdges; } @@ -352,11 +352,11 @@ public class WorldMap { return railNodes; } - public Pair getWire(String key) { + public Entry getWire(String key) { return wires.get(key); } - public Map> getWires() { + public Map> getWires() { return wires; } @@ -469,13 +469,13 @@ public class WorldMap { RailEdge edge2 = new RailEdge(p2, d2, p1, d1, curved); node2.addOutgoingEdge(edge2); node1.addIncomingEdge(edge2); - railEdges.add(new Pair<>(edge1, edge2)); + railEdges.add(new SimpleEntry<>(edge1, edge2)); } public void setUndergroundBeltEnding(String name, Point2D.Double pos, Direction dir) { int kr = (int) Math.floor(pos.x); int kc = (int) Math.floor(pos.y); - undergroundBeltEndings.put(kr, kc, new Pair<>(name, dir)); + undergroundBeltEndings.put(kr, kc, new SimpleEntry<>(name, dir)); } public void setVerticalGate(Point2D.Double pos) { @@ -490,7 +490,7 @@ public class WorldMap { walls.put(kr, kc, pos); } - public void setWire(String key, Pair pair) { + public void setWire(String key, Entry pair) { wires.put(key, pair); } } diff --git a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotDiscordService.java b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotDiscordService.java index e582096..6a923ba 100644 --- a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotDiscordService.java +++ b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotDiscordService.java @@ -8,6 +8,7 @@ import java.io.StringWriter; import java.lang.reflect.Field; import java.net.URL; import java.time.Instant; +import java.util.AbstractMap.SimpleEntry; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; @@ -15,6 +16,7 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Optional; import java.util.Set; import java.util.function.Function; @@ -53,7 +55,6 @@ import com.google.common.collect.LinkedHashMultiset; import com.google.common.collect.Multiset; import com.google.common.util.concurrent.AbstractIdleService; -import javafx.util.Pair; import net.dv8tion.jda.core.EmbedBuilder; import net.dv8tion.jda.core.Permission; import net.dv8tion.jda.core.entities.Message; @@ -185,7 +186,7 @@ public class BlueprintBotDiscordService extends AbstractIdleService { if (!prototype.isPresent()) { LevenshteinDistance levenshteinDistance = LevenshteinDistance.getDefaultInstance(); List suggestions = map.keySet().stream() - .map(k -> new Pair<>(k, levenshteinDistance.apply(search, k))) + .map(k -> new SimpleEntry<>(k, levenshteinDistance.apply(search, k))) .sorted((p1, p2) -> Integer.compare(p1.getValue(), p2.getValue())).limit(5) .map(p -> p.getKey()).collect(Collectors.toList()); event.getChannel() @@ -211,7 +212,7 @@ public class BlueprintBotDiscordService extends AbstractIdleService { Optional context = reporting.getContext(); List exceptions = reporting.getExceptions(); List warnings = reporting.getWarnings(); - List, String>> images = reporting.getImages(); + List, String>> images = reporting.getImages(); List links = reporting.getLinks(); List downloads = reporting.getDownloads(); Set info = reporting.getInfo(); @@ -241,7 +242,7 @@ public class BlueprintBotDiscordService extends AbstractIdleService { } if (images.size() > 1) { WebUtils.addPossiblyLargeEmbedField(builder, "Additional Image(s)", - images.stream().skip(1).map(Pair::getValue).collect(Collectors.joining("\n")), false); + images.stream().skip(1).map(Entry::getValue).collect(Collectors.joining("\n")), false); } if (!downloads.isEmpty()) { @@ -415,17 +416,16 @@ public class BlueprintBotDiscordService extends AbstractIdleService { List blueprints = blueprintStrings.stream().flatMap(bs -> bs.getBlueprints().stream()) .collect(Collectors.toList()); - List> links = new ArrayList<>(); + List> links = new ArrayList<>(); for (Blueprint blueprint : blueprints) { try { blueprint.json().remove("index"); URL url = WebUtils.uploadToHostingService("blueprint.txt", (/* - * blueprint.getLabel().orElse("Blueprint String") + - * ": " + * blueprint.getLabel().orElse("Blueprint String") + ": " */" " + BlueprintStringData.encode(blueprint.json())).getBytes()); - links.add(new Pair<>(url, blueprint.getLabel().orElse(null))); + links.add(new SimpleEntry<>(url, blueprint.getLabel().orElse(null))); } catch (Exception e) { reporting.addException(e); } @@ -703,10 +703,10 @@ public class BlueprintBotDiscordService extends AbstractIdleService { reporting.addInfo(WebUtils.uploadToHostingService("blueprint.png", image).toString()); } } else { - List> links = new ArrayList<>(); + List> links = new ArrayList<>(); for (Blueprint blueprint : blueprintString.getBlueprints()) { BufferedImage image = FBSR.renderBlueprint(blueprint, reporting); - links.add(new Pair<>(WebUtils.uploadToHostingService("blueprint.png", image), + links.add(new SimpleEntry<>(WebUtils.uploadToHostingService("blueprint.png", image), blueprint.getLabel().orElse(""))); } try { @@ -727,11 +727,12 @@ public class BlueprintBotDiscordService extends AbstractIdleService { } } - private void sendBundlyReplacementEmbed(MessageChannel channel, String title, List> links) + private void sendBundlyReplacementEmbed(MessageChannel channel, String title, List> links) throws IllegalStateException { ArrayDeque linksFormatted = links.stream() .map(p -> (p.getValue() != null && !p.getValue().isEmpty()) - ? ("[" + p.getValue() + "](" + p.getKey() + ")") : p.getKey().toString()) + ? ("[" + p.getValue() + "](" + p.getKey() + ")") + : p.getKey().toString()) .collect(Collectors.toCollection(ArrayDeque::new)); while (!linksFormatted.isEmpty()) { EmbedBuilder builder = new EmbedBuilder(); @@ -765,9 +766,8 @@ public class BlueprintBotDiscordService extends AbstractIdleService { public void sendReport(MessageReceivedEvent event, TaskReporting reporting) { if (!reporting.getExceptions().isEmpty()) { - event.getChannel() - .sendMessage( - "There was a problem completing your request. I have contacted my programmer to fix it for you!") + event.getChannel().sendMessage( + "There was a problem completing your request. I have contacted my programmer to fix it for you!") .complete(); } diff --git a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotIRCService.java b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotIRCService.java index 5029c06..9538339 100644 --- a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotIRCService.java +++ b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotIRCService.java @@ -3,8 +3,10 @@ package com.demod.fbsr.app; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; +import java.util.AbstractMap.SimpleEntry; import java.util.ArrayList; import java.util.List; +import java.util.Map.Entry; import java.util.stream.Collectors; import org.json.JSONObject; @@ -22,8 +24,6 @@ import com.demod.fbsr.TaskReporting; import com.demod.fbsr.WebUtils; import com.google.common.util.concurrent.AbstractIdleService; -import javafx.util.Pair; - public class BlueprintBotIRCService extends AbstractIdleService { private static final String IRC_AUTHOR_URL = "http://peterbjornx.nl/wp-content/uploads/2013/08/irc_icon.png"; @@ -51,10 +51,10 @@ public class BlueprintBotIRCService extends AbstractIdleService { reporting.addInfo(WebUtils.uploadToHostingService("blueprint.png", image).toString()); } else { - List> links = new ArrayList<>(); + List> links = new ArrayList<>(); for (Blueprint blueprint : blueprintString.getBlueprints()) { BufferedImage image = FBSR.renderBlueprint(blueprint, reporting); - links.add(new Pair<>(WebUtils.uploadToHostingService("blueprint.png", image), + links.add(new SimpleEntry<>(WebUtils.uploadToHostingService("blueprint.png", image), blueprint.getLabel().orElse(""))); } diff --git a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotRedditService.java b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotRedditService.java index 94263c1..75992a8 100644 --- a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotRedditService.java +++ b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotRedditService.java @@ -8,10 +8,12 @@ import java.io.FileWriter; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; +import java.util.AbstractMap.SimpleEntry; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.List; +import java.util.Map.Entry; import java.util.Optional; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -29,7 +31,6 @@ import com.demod.fbsr.WebUtils; import com.google.common.util.concurrent.AbstractScheduledService; import com.google.common.util.concurrent.Uninterruptibles; -import javafx.util.Pair; import net.dean.jraw.ApiException; import net.dean.jraw.RedditClient; import net.dean.jraw.http.NetworkException; @@ -157,15 +158,15 @@ public class BlueprintBotRedditService extends AbstractScheduledService { } List lines = new ArrayList<>(); - List, String>> images = reporting.getImages(); + List, String>> images = reporting.getImages(); if (images.size() > 1) { int id = 1; - List> links = new ArrayList<>(); - for (Pair, String> pair : images) { + List> links = new ArrayList<>(); + for (Entry, String> pair : images) { Optional label = pair.getKey(); String url = pair.getValue(); try { - links.add(new Pair<>(new URL(url), label.orElse(null))); + links.add(new SimpleEntry<>(new URL(url), label.orElse(null))); } catch (MalformedURLException e) { reporting.addException(e); } @@ -183,13 +184,13 @@ public class BlueprintBotRedditService extends AbstractScheduledService { } else { lines.add("Blueprint Images:"); } - for (Pair, String> pair : images) { + for (Entry, String> pair : images) { Optional label = pair.getKey(); String url = pair.getValue(); lines.add("[" + (id++) + ": " + label.orElse("Blueprint") + "](" + url + ")"); } } else if (!images.isEmpty()) { - Pair, String> pair = images.get(0); + Entry, String> pair = images.get(0); Optional label = pair.getKey(); String url = pair.getValue(); lines.add("[Blueprint Image" + label.map(s -> " (" + s + ")").orElse("") + "](" + url + ")"); @@ -224,7 +225,7 @@ public class BlueprintBotRedditService extends AbstractScheduledService { int processedCount = 0; long newestMillis = lastProcessedMillis; - List> pendingReplies = new LinkedList<>(); + List> pendingReplies = new LinkedList<>(); paginate: for (Listing listing : commentStream) { for (Comment comment : listing) { long createMillis = comment.getCreated().getTime(); @@ -246,11 +247,11 @@ public class BlueprintBotRedditService extends AbstractScheduledService { Optional response = processContent(comment.getBody(), getPermaLink(comment), comment.getSubredditName(), comment.getAuthor(), watchdog); if (response.isPresent()) { - pendingReplies.add(new Pair<>(comment, response.get())); + pendingReplies.add(new SimpleEntry<>(comment, response.get())); } } } - for (Pair pair : pendingReplies) { + for (Entry pair : pendingReplies) { System.out.println("IM TRYING TO REPLY TO A COMMENT!"); while (true) { try { @@ -287,7 +288,7 @@ public class BlueprintBotRedditService extends AbstractScheduledService { int processedCount = 0; long newestMillis = lastProcessedMillis; - List> pendingReplies = new LinkedList<>(); + List> pendingReplies = new LinkedList<>(); List processedMessages = new LinkedList<>(); paginate: for (Listing listing : paginator) { for (Message message : listing) { @@ -308,7 +309,7 @@ public class BlueprintBotRedditService extends AbstractScheduledService { Optional response = processContent(message.getBody(), getPermaLink(message), "(Private)", message.getAuthor(), watchdog); if (response.isPresent()) { - pendingReplies.add(new Pair<>(message, response.get())); + pendingReplies.add(new SimpleEntry<>(message, response.get())); } } } @@ -318,7 +319,7 @@ public class BlueprintBotRedditService extends AbstractScheduledService { processedMessages.stream().skip(1).toArray(Message[]::new)); } - for (Pair pair : pendingReplies) { + for (Entry pair : pendingReplies) { System.out.println("IM TRYING TO REPLY TO A MESSAGE!"); while (true) { try { @@ -354,7 +355,7 @@ public class BlueprintBotRedditService extends AbstractScheduledService { int processedCount = 0; long newestMillis = lastProcessedMillis; - List> pendingReplies = new LinkedList<>(); + List> pendingReplies = new LinkedList<>(); paginate: for (Listing listing : paginator) { for (Submission submission : listing) { long createMillis = submission.getCreated().getTime(); @@ -381,11 +382,11 @@ public class BlueprintBotRedditService extends AbstractScheduledService { Optional response = processContent(submission.getSelftext(), submission.getUrl(), submission.getSubredditName(), submission.getAuthor(), watchdog); if (response.isPresent()) { - pendingReplies.add(new Pair<>(submission, response.get())); + pendingReplies.add(new SimpleEntry<>(submission, response.get())); } } } - for (Pair pair : pendingReplies) { + for (Entry pair : pendingReplies) { System.out.println("IM TRYING TO REPLY TO A SUBMISSION!"); while (true) { try { diff --git a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/WebAPIService.java b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/WebAPIService.java index ab22de5..70b23ba 100644 --- a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/WebAPIService.java +++ b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/WebAPIService.java @@ -2,6 +2,7 @@ package com.demod.fbsr.app; import java.awt.image.BufferedImage; import java.util.List; +import java.util.Map.Entry; import java.util.Optional; import java.util.stream.Collectors; @@ -21,8 +22,6 @@ import com.demod.fbsr.TaskReporting; import com.demod.fbsr.WebUtils; import com.google.common.util.concurrent.AbstractIdleService; -import javafx.util.Pair; - public class WebAPIService extends AbstractIdleService { private JSONObject configJson; @@ -81,7 +80,7 @@ public class WebAPIService extends AbstractIdleService { if (!reporting.getImages().isEmpty()) { JSONArray images = new JSONArray(); - for (Pair, String> pair : reporting.getImages()) { + for (Entry, String> pair : reporting.getImages()) { JSONObject image = new JSONObject(); Utils.terribleHackToHaveOrderedJSONObject(image); pair.getKey().ifPresent(l -> image.put("label", l));