diff --git a/src/apps/MapDesignerVector.java b/src/apps/MapDesignerVector.java index 677df2e..375640d 100644 --- a/src/apps/MapDesignerVector.java +++ b/src/apps/MapDesignerVector.java @@ -49,6 +49,7 @@ import org.xml.sax.SAXException; import javax.xml.parsers.ParserConfigurationException; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.function.BiConsumer; @@ -334,7 +335,7 @@ public class MapDesignerVector extends MapApplication { else if (elementS instanceof GeographicPath) { GeographicPath pathS = (GeographicPath) elementS; List commandsS = pathS.commands; - List commandsP = new LinkedList<>(); + List commandsP = new ArrayList<>(); if (commandsS.size() > 2*max(1, step)) { int j = 0; while (j < commandsS.size()) { diff --git a/src/image/Path.java b/src/image/Path.java index 625153b..2b1c8ab 100644 --- a/src/image/Path.java +++ b/src/image/Path.java @@ -3,7 +3,6 @@ package image; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.LinkedList; import java.util.List; import static java.lang.Double.isFinite; @@ -69,7 +68,7 @@ public class Path { * shift a path by some amount in some direction */ public static List translated(double xShift, double yShift, List path) { - List newPath = new LinkedList<>(); + List newPath = new ArrayList<>(); for (Command old: path) { double[] newArgs = Arrays.copyOf(old.args, old.args.length); switch (old.type) { @@ -109,7 +108,7 @@ public class Path { * either or both may be negative. */ public static List scaled(double xScale, double yScale, List path) { - List newPath = new LinkedList<>(); + List newPath = new ArrayList<>(); for (Command old: path) { double[] newArgs = Arrays.copyOf(old.args, old.args.length); switch (old.type) { @@ -154,7 +153,7 @@ public class Path { * positive is widdershins and negative is clockwise. */ public static List rotated(double rotation, List path) { - List newPath = new LinkedList<>(); + List newPath = new ArrayList<>(); for (Command old: path) { char newType = old.type; double[] newArgs = Arrays.copyOf(old.args, old.args.length); diff --git a/src/image/SVGMap.java b/src/image/SVGMap.java index 76e5e3b..92fd928 100644 --- a/src/image/SVGMap.java +++ b/src/image/SVGMap.java @@ -42,7 +42,6 @@ import java.nio.file.Files; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Stack; @@ -50,7 +49,6 @@ import static java.lang.Double.NaN; import static java.lang.Double.parseDouble; import static java.lang.Math.PI; import static java.lang.Math.hypot; -import static java.lang.Math.min; import static java.lang.String.format; import static utils.Math2.linInterp; import static utils.Math2.max; @@ -78,7 +76,7 @@ public class SVGMap implements Iterable, SavableImage { * @throws ParserConfigurationException if the SAXParser object can't be constructed for some reason */ public SVGMap(File file) throws IOException, SAXException, ParserConfigurationException { - elements = new LinkedList<>(); // the list elements + elements = new ArrayList<>(); // the list elements final SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); @@ -467,7 +465,7 @@ public class SVGMap implements Iterable, SavableImage { */ public static GeographicPath breakWraps(GeographicPath continuous, double inSize, boolean strict) { //break excessively long commands, as they are likely wrapping over a discontinuity if (continuous.commands.size() <= 2) return continuous; - List broken = new LinkedList<>(); + List broken = new ArrayList<>(); double[] lens = {0, 0, 0}; //the revolving array of command lengths for (int i = 0; i < continuous.commands.size(); i ++) { if (i < continuous.commands.size()-1 && continuous.commands.get(i+1).type != 'M') @@ -502,7 +500,7 @@ public class SVGMap implements Iterable, SavableImage { if (cmd.type == 'M') { //separated by movetos if (currentPart != null) parts.add(currentPart); - currentPart = new LinkedList(); + currentPart = new ArrayList(); } else if (currentPart == null) throw new RuntimeException(format( @@ -511,7 +509,7 @@ public class SVGMap implements Iterable, SavableImage { } parts.add(currentPart); - List closed = new LinkedList(); + List closed = new ArrayList(); for (int i = 0; i < parts.size(); i ++) { //now look through those parts List partI = parts.get(i); if (partI.size() > 1 diff --git a/src/maps/Projection.java b/src/maps/Projection.java index 2bb63eb..72ff7b1 100644 --- a/src/maps/Projection.java +++ b/src/maps/Projection.java @@ -355,7 +355,7 @@ public abstract class Projection { */ public List drawGraticule(double spacing, double precision, double outW, double outH, double maxLat, double maxLon, double[] pole) { - List output = new LinkedList<>(); + List output = new ArrayList<>(); for (int y = 0; y < (int)(maxLat/spacing); y ++) { output.addAll(drawLoxodrome( //northern parallel