Fix newly detected violations from PMD 7
This commit is contained in:
parent
2f7ce42480
commit
dd896347a2
28 changed files with 65 additions and 57 deletions
|
@ -1,6 +1,7 @@
|
|||
package btools.codec;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import btools.util.ByteDataReader;
|
||||
import btools.util.IByteArrayUnifier;
|
||||
|
@ -287,7 +288,7 @@ public final class MicroCache2 extends MicroCache {
|
|||
|
||||
@Override
|
||||
public int encodeMicroCache(byte[] buffer) {
|
||||
HashMap<Long, Integer> idMap = new HashMap<>();
|
||||
Map<Long, Integer> idMap = new HashMap<>();
|
||||
for (int n = 0; n < size; n++) { // loop over nodes
|
||||
idMap.put(expandId(faid[n]), n);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Comparator;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Queue;
|
||||
|
||||
import btools.util.BitCoderContext;
|
||||
|
||||
|
@ -58,7 +59,7 @@ public final class TagValueCoder {
|
|||
TagValueSet dummy = new TagValueSet(nextTagValueSetId++);
|
||||
identityMap.put(dummy, dummy);
|
||||
}
|
||||
PriorityQueue<TagValueSet> queue = new PriorityQueue<>(2 * identityMap.size(), new TagValueSet.FrequencyComparator());
|
||||
Queue<TagValueSet> queue = new PriorityQueue<>(2 * identityMap.size(), new TagValueSet.FrequencyComparator());
|
||||
queue.addAll(identityMap.values());
|
||||
while (queue.size() > 1) {
|
||||
TagValueSet node = new TagValueSet(nextTagValueSetId++);
|
||||
|
|
|
@ -168,7 +168,7 @@ public class OsmNogoPolygon extends OsmNodeNamed {
|
|||
Point p1 = points.get(0);
|
||||
for (int i = 1; i <= i_last; i++) {
|
||||
final Point p2 = points.get(i);
|
||||
if (OsmNogoPolygon.isOnLine(px, py, p1.x, p1.y, p2.x, p2.y)) {
|
||||
if (isOnLine(px, py, p1.x, p1.y, p2.x, p2.y)) {
|
||||
return true;
|
||||
}
|
||||
p1 = p2;
|
||||
|
@ -234,7 +234,7 @@ public class OsmNogoPolygon extends OsmNodeNamed {
|
|||
final long p1x = p1.x;
|
||||
final long p1y = p1.y;
|
||||
|
||||
if (OsmNogoPolygon.isOnLine(px, py, p0x, p0y, p1x, p1y)) {
|
||||
if (isOnLine(px, py, p0x, p0y, p1x, p1y)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ public final class OsmTrack {
|
|||
}
|
||||
|
||||
public List<String> aggregateMessages() {
|
||||
ArrayList<String> res = new ArrayList<>();
|
||||
List<String> res = new ArrayList<>();
|
||||
MessageData current = null;
|
||||
for (OsmPathElement n : nodes) {
|
||||
if (n.message != null && n.message.wayKeyValues != null) {
|
||||
|
@ -188,7 +188,7 @@ public final class OsmTrack {
|
|||
}
|
||||
|
||||
public List<String> aggregateSpeedProfile() {
|
||||
ArrayList<String> res = new ArrayList<>();
|
||||
List<String> res = new ArrayList<>();
|
||||
int vmax = -1;
|
||||
int vmaxe = -1;
|
||||
int vmin = -1;
|
||||
|
|
|
@ -187,7 +187,7 @@ public class RoutingEngine extends Thread {
|
|||
OsmTrack[] refTracks = new OsmTrack[nsections]; // used ways for alternatives
|
||||
OsmTrack[] lastTracks = new OsmTrack[nsections];
|
||||
OsmTrack track = null;
|
||||
ArrayList<String> messageList = new ArrayList<>();
|
||||
List<String> messageList = new ArrayList<>();
|
||||
for (int i = 0; ; i++) {
|
||||
track = findTrack(refTracks, lastTracks);
|
||||
track.message = "track-length = " + track.distance + " filtered ascend = " + track.ascend
|
||||
|
@ -690,9 +690,9 @@ public class RoutingEngine extends Thread {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
ArrayList<OsmPathElement> removeBackList = new ArrayList<>();
|
||||
ArrayList<OsmPathElement> removeForeList = new ArrayList<>();
|
||||
ArrayList<Integer> removeVoiceHintList = new ArrayList<>();
|
||||
List<OsmPathElement> removeBackList = new ArrayList<>();
|
||||
List<OsmPathElement> removeForeList = new ArrayList<>();
|
||||
List<Integer> removeVoiceHintList = new ArrayList<>();
|
||||
OsmPathElement last = null;
|
||||
OsmPathElement lastJunction = null;
|
||||
CompactLongMap<OsmTrack.OsmPathElementHolder> lastJunctions = new CompactLongMap<>();
|
||||
|
@ -1246,7 +1246,7 @@ public class RoutingEngine extends Thread {
|
|||
addToOpenset(startPath1);
|
||||
addToOpenset(startPath2);
|
||||
}
|
||||
ArrayList<OsmPath> openBorderList = new ArrayList<>(4096);
|
||||
List<OsmPath> openBorderList = new ArrayList<>(4096);
|
||||
boolean memoryPanicMode = false;
|
||||
boolean needNonPanicProcessing = false;
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ public class RoutingParamCollector {
|
|||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
public Map<String, String> getUrlParams(String url) throws UnsupportedEncodingException {
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
String decoded = URLDecoder.decode(url, "UTF-8");
|
||||
StringTokenizer tk = new StringTokenizer(decoded, "?&");
|
||||
while (tk.hasMoreTokens()) {
|
||||
|
|
|
@ -242,15 +242,15 @@ final class BExpression {
|
|||
}
|
||||
// parse operands
|
||||
if (nops > 0) {
|
||||
exp.op1 = BExpression.parse(ctx, level + 1, exp.typ == ASSIGN_EXP ? "=" : null);
|
||||
exp.op1 = parse(ctx, level + 1, exp.typ == ASSIGN_EXP ? "=" : null);
|
||||
}
|
||||
if (nops > 1) {
|
||||
if (ifThenElse) checkExpectedToken(ctx, "then");
|
||||
exp.op2 = BExpression.parse(ctx, level + 1, null);
|
||||
exp.op2 = parse(ctx, level + 1, null);
|
||||
}
|
||||
if (nops > 2) {
|
||||
if (ifThenElse) checkExpectedToken(ctx, "else");
|
||||
exp.op3 = BExpression.parse(ctx, level + 1, null);
|
||||
exp.op3 = parse(ctx, level + 1, null);
|
||||
}
|
||||
if (brackets) {
|
||||
checkExpectedToken(ctx, ")");
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.Arrays;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.Random;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.TreeMap;
|
||||
|
@ -227,7 +228,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
|
|||
}
|
||||
|
||||
public List<String> getKeyValueList(boolean inverseDirection, byte[] ab) {
|
||||
ArrayList<String> res = new ArrayList<>();
|
||||
List<String> res = new ArrayList<>();
|
||||
decode(lookupData, inverseDirection, ab);
|
||||
for (int inum = 0; inum < lookupValues.size(); inum++) { // loop over lookup names
|
||||
BExpressionLookupValue[] va = lookupValues.get(inum);
|
||||
|
@ -433,7 +434,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
|
|||
|
||||
|
||||
public void dumpStatistics() {
|
||||
TreeMap<String, String> counts = new TreeMap<>();
|
||||
NavigableMap<String, String> counts = new TreeMap<>();
|
||||
// first count
|
||||
for (String name : lookupNumbers.keySet()) {
|
||||
int cnt = 0;
|
||||
|
|
|
@ -184,10 +184,10 @@ public class CreateElevationRasterImage {
|
|||
if (DEBUG) System.out.println(line);
|
||||
String[] sa = line.split(",");
|
||||
if (!line.startsWith("#") && sa.length == 4) {
|
||||
short e = Short.valueOf(sa[0].trim());
|
||||
short r = Short.valueOf(sa[1].trim());
|
||||
short g = Short.valueOf(sa[2].trim());
|
||||
short b = Short.valueOf(sa[3].trim());
|
||||
short e = Short.parseShort(sa[0].trim());
|
||||
short r = Short.parseShort(sa[1].trim());
|
||||
short g = Short.parseShort(sa[2].trim());
|
||||
short b = Short.parseShort(sa[3].trim());
|
||||
colorMap.put(e, new Color(r, g, b));
|
||||
}
|
||||
// read next line
|
||||
|
|
|
@ -90,7 +90,6 @@ public class ElevationRasterTileConverter {
|
|||
} else {
|
||||
System.out.println("usage: java <srtm-filename> <hgt-data-dir> <srtm-output-dir> [arc seconds (1 or 3,default=3)] [hgt-fallback-data-dir]");
|
||||
System.out.println("or java all <hgt-data-dir> <srtm-output-dir> [arc seconds (1 or 3, default=3)] [hgt-fallback-data-dir]");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ package btools.mapcreator;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import btools.codec.MicroCache;
|
||||
import btools.codec.MicroCache2;
|
||||
|
@ -105,7 +107,7 @@ public class OsmNodeP extends OsmLinkP {
|
|||
}
|
||||
|
||||
public void checkDuplicateTargets() {
|
||||
HashMap<OsmNodeP, OsmLinkP> targets = new HashMap<>();
|
||||
Map<OsmNodeP, OsmLinkP> targets = new HashMap<>();
|
||||
|
||||
for (OsmLinkP link0 = getFirstLink(); link0 != null; link0 = link0.getNext(this)) {
|
||||
OsmLinkP link = link0;
|
||||
|
@ -165,14 +167,14 @@ public class OsmNodeP extends OsmLinkP {
|
|||
mc.writeVarBytes(getNodeDecsription());
|
||||
|
||||
// buffer internal reverse links
|
||||
ArrayList<OsmNodeP> internalReverse = new ArrayList<>();
|
||||
List<OsmNodeP> internalReverse = new ArrayList<>();
|
||||
|
||||
for (OsmLinkP link0 = getFirstLink(); link0 != null; link0 = link0.getNext(this)) {
|
||||
OsmLinkP link = link0;
|
||||
OsmNodeP origin = this;
|
||||
OsmNodeP target = null;
|
||||
|
||||
ArrayList<OsmNodeP> linkNodes = new ArrayList<>();
|
||||
List<OsmNodeP> linkNodes = new ArrayList<>();
|
||||
linkNodes.add(this);
|
||||
|
||||
// first pass just to see if that link is consistent
|
||||
|
@ -226,7 +228,7 @@ public class OsmNodeP extends OsmLinkP {
|
|||
origin = this;
|
||||
for (int i = 1; i < linkNodes.size() - 1; i++) {
|
||||
OsmNodeP tranferNode = linkNodes.get(i);
|
||||
if ((tranferNode.bits & OsmNodeP.DP_SURVIVOR_BIT) != 0) {
|
||||
if ((tranferNode.bits & DP_SURVIVOR_BIT) != 0) {
|
||||
mc.writeVarLengthSigned(tranferNode.ilon - origin.ilon);
|
||||
mc.writeVarLengthSigned(tranferNode.ilat - origin.ilat);
|
||||
mc.writeVarLengthSigned(tranferNode.getSElev() - origin.getSElev());
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.io.DataInputStream;
|
|||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* WayCutter does 2 step in map-processing:
|
||||
|
@ -25,7 +26,7 @@ public class RelationStatistics extends MapCreatorBase {
|
|||
}
|
||||
|
||||
public void process(File relationFileIn) throws Exception {
|
||||
HashMap<String, long[]> relstats = new HashMap<>();
|
||||
Map<String, long[]> relstats = new HashMap<>();
|
||||
|
||||
DataInputStream dis = createInStream(relationFileIn);
|
||||
try {
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.io.File;
|
|||
import java.io.FileInputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import btools.codec.DataBuffers;
|
||||
|
@ -481,7 +482,7 @@ public class WayLinker extends MapCreatorBase implements Runnable {
|
|||
MicroCache mc = new MicroCache2(size, abBuf2, lonIdxDiv, latIdxDiv, divisor);
|
||||
|
||||
// sort via treemap
|
||||
TreeMap<Integer, OsmNodeP> sortedList = new TreeMap<>();
|
||||
Map<Integer, OsmNodeP> sortedList = new TreeMap<>();
|
||||
for (OsmNodeP n : subList) {
|
||||
long longId = n.getIdFromPos();
|
||||
int shrinkid = mc.shrinkId(longId);
|
||||
|
|
|
@ -31,7 +31,6 @@ final class OsmFile {
|
|||
|
||||
private int divisor;
|
||||
private int cellsize;
|
||||
private int ncaches;
|
||||
private int indexsize;
|
||||
protected byte elevationType = 3;
|
||||
|
||||
|
@ -47,7 +46,7 @@ final class OsmFile {
|
|||
elevationType = rafile.elevationType;
|
||||
|
||||
cellsize = 1000000 / divisor;
|
||||
ncaches = divisor * divisor;
|
||||
int ncaches = divisor * divisor;
|
||||
indexsize = ncaches * 4;
|
||||
|
||||
byte[] iobuffer = dataBuffers.iobuffer;
|
||||
|
@ -143,7 +142,7 @@ final class OsmFile {
|
|||
new DirectWeaver(bc, dataBuffers, lonIdx, latIdx, divisor, wayValidator, waypointMatcher, hollowNodes);
|
||||
return MicroCache.emptyNonVirgin;
|
||||
} finally {
|
||||
// crc check only if the buffer has not been fully read
|
||||
// crc check only if the buffer has not been fully read
|
||||
int readBytes = (bc.getReadingBitPosition() + 7) >> 3;
|
||||
if (readBytes != asize - 4) {
|
||||
int crcData = Crc32.crc(ab, 0, asize - 4);
|
||||
|
|
|
@ -21,7 +21,7 @@ public class OsmNodePairSet {
|
|||
n2a = new long[maxTempNodes];
|
||||
}
|
||||
|
||||
private static class OsmNodePair {
|
||||
private static final class OsmNodePair {
|
||||
public long node2;
|
||||
public OsmNodePair next;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public final class WaypointMatcherImpl implements WaypointMatcher {
|
|||
}
|
||||
|
||||
// sort result list
|
||||
comparator = new Comparator<MatchedWaypoint>() {
|
||||
comparator = new Comparator<>() {
|
||||
@Override
|
||||
public int compare(MatchedWaypoint mw1, MatchedWaypoint mw2) {
|
||||
int cmpDist = Double.compare(mw1.radius, mw2.radius);
|
||||
|
|
|
@ -31,7 +31,7 @@ public class IpAccessMonitor {
|
|||
}
|
||||
|
||||
private static void cleanup(long t) {
|
||||
HashMap<String, Long> newMap = new HashMap<>(ipAccess.size());
|
||||
Map<String, Long> newMap = new HashMap<>(ipAccess.size());
|
||||
for (Map.Entry<String, Long> e : ipAccess.entrySet()) {
|
||||
if (t - e.getValue().longValue() <= MAX_IDLE) {
|
||||
newMap.put(e.getKey(), e.getValue());
|
||||
|
|
|
@ -3,6 +3,7 @@ package btools.server;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class Polygon {
|
||||
|
@ -15,7 +16,7 @@ public class Polygon {
|
|||
private int maxy = Integer.MIN_VALUE;
|
||||
|
||||
public Polygon(BufferedReader br) throws IOException {
|
||||
ArrayList<String> lines = new ArrayList<>();
|
||||
List<String> lines = new ArrayList<>();
|
||||
|
||||
for (; ; ) {
|
||||
String line = br.readLine();
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Queue;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
|
@ -299,7 +300,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
|
|||
|
||||
ProfileCache.setSize(2 * maxthreads);
|
||||
|
||||
PriorityQueue<RouteServer> threadQueue = new PriorityQueue<>();
|
||||
Queue<RouteServer> threadQueue = new PriorityQueue<>();
|
||||
|
||||
ServerSocket serverSocket = args.length > 5 ? new ServerSocket(Integer.parseInt(args[3]), 100, InetAddress.getByName(args[5])) : new ServerSocket(Integer.parseInt(args[3]));
|
||||
|
||||
|
@ -364,7 +365,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
|
|||
|
||||
|
||||
private static Map<String, String> getUrlParams(String url) throws UnsupportedEncodingException {
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
String decoded = URLDecoder.decode(url, "UTF-8");
|
||||
StringTokenizer tk = new StringTokenizer(decoded, "?&");
|
||||
while (tk.hasMoreTokens()) {
|
||||
|
@ -417,7 +418,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
|
|||
bw.write("\n");
|
||||
}
|
||||
|
||||
private static void cleanupThreadQueue(PriorityQueue<RouteServer> threadQueue) {
|
||||
private static void cleanupThreadQueue(Queue<RouteServer> threadQueue) {
|
||||
for (; ; ) {
|
||||
boolean removedItem = false;
|
||||
for (RouteServer t : threadQueue) {
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.TreeSet;
|
||||
|
||||
|
@ -244,7 +245,7 @@ public class SuspectManager extends Thread {
|
|||
bw.write("<table>\n");
|
||||
File countryParent = new File("worldpolys" + country);
|
||||
File[] files = countryParent.listFiles();
|
||||
TreeSet<String> names = new TreeSet<>();
|
||||
Set<String> names = new TreeSet<>();
|
||||
for (File f : files) {
|
||||
String name = f.getName();
|
||||
if (name.endsWith(".poly")) {
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ProfileUploadHandler {
|
|||
String id;
|
||||
if (profileId != null) {
|
||||
// update existing file when id appended
|
||||
id = profileId.substring(ProfileUploadHandler.CUSTOM_PREFIX.length());
|
||||
id = profileId.substring(CUSTOM_PREFIX.length());
|
||||
} else {
|
||||
id = "" + System.currentTimeMillis();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.junit.Ignore;
|
|||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import btools.router.RoutingContext;
|
||||
import btools.server.request.ServerHandler;
|
||||
|
@ -13,7 +14,7 @@ public class RequestHandlerTest {
|
|||
@Test
|
||||
@Ignore("Parameters are currently handled by RouteServer, not RequestHandler")
|
||||
public void parseParameters() {
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("lonlats", "8.799297,49.565883|8.811764,49.563606");
|
||||
params.put("profile", "trekking");
|
||||
params.put("alternativeidx", "0");
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.List;
|
|||
*
|
||||
* @author ab
|
||||
*/
|
||||
@SuppressWarnings("PMD.LooseCoupling")
|
||||
public class LazyArrayOfLists<E> {
|
||||
private List<ArrayList<E>> lists;
|
||||
|
||||
|
|
|
@ -51,12 +51,12 @@ public class StackSampler extends Thread {
|
|||
try {
|
||||
int wait1 = rand.nextInt(interval);
|
||||
int wait2 = interval - wait1;
|
||||
Thread.sleep(wait1);
|
||||
sleep(wait1);
|
||||
StringBuilder sb = new StringBuilder(df.format(new Date()) + " THREADDUMP\n");
|
||||
Map<Thread, StackTraceElement[]> allThreads = Thread.getAllStackTraces();
|
||||
Map<Thread, StackTraceElement[]> allThreads = getAllStackTraces();
|
||||
for (Map.Entry<Thread, StackTraceElement[]> e : allThreads.entrySet()) {
|
||||
Thread t = e.getKey();
|
||||
if (t == Thread.currentThread()) {
|
||||
if (t == currentThread()) {
|
||||
continue; // not me
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ public class StackSampler extends Thread {
|
|||
flushCnt = 0;
|
||||
bw.flush();
|
||||
}
|
||||
Thread.sleep(wait2);
|
||||
sleep(wait2);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import org.junit.Assert;
|
|||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class CompactMapTest {
|
||||
|
@ -22,7 +23,7 @@ public class CompactMapTest {
|
|||
|
||||
private void hashMapComparison(int mapsize, int trycount) {
|
||||
Random rand = new Random(12345);
|
||||
HashMap<Long, String> hmap = new HashMap<>();
|
||||
Map<Long, String> hmap = new HashMap<>();
|
||||
CompactLongMap<String> cmap_slow = new CompactLongMap<>();
|
||||
CompactLongMap<String> cmap_fast = new CompactLongMap<>();
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.junit.Test;
|
|||
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
public class CompactSetTest {
|
||||
@Test
|
||||
|
@ -22,7 +23,7 @@ public class CompactSetTest {
|
|||
|
||||
private void hashSetComparison(int setsize, int trycount) {
|
||||
Random rand = new Random(12345);
|
||||
HashSet<Long> hset = new HashSet<>();
|
||||
Set<Long> hset = new HashSet<>();
|
||||
CompactLongSet cset_slow = new CompactLongSet();
|
||||
CompactLongSet cset_fast = new CompactLongSet();
|
||||
|
||||
|
|
|
@ -5,7 +5,9 @@ import org.junit.Test;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
public class DenseLongMapTest {
|
||||
@Test
|
||||
|
@ -16,7 +18,7 @@ public class DenseLongMapTest {
|
|||
|
||||
private void hashMapComparison(int mapsize, int trycount, long keyrange) {
|
||||
Random rand = new Random(12345);
|
||||
HashMap<Long, Integer> hmap = new HashMap<>();
|
||||
Map<Long, Integer> hmap = new HashMap<>();
|
||||
DenseLongMap dmap = new DenseLongMap(512);
|
||||
|
||||
for (int i = 0; i < mapsize; i++) {
|
||||
|
@ -48,7 +50,7 @@ public class DenseLongMapTest {
|
|||
int trycount = 100000;
|
||||
|
||||
Random rand = new Random(12345);
|
||||
HashSet<Long> hset = new HashSet<>();
|
||||
Set<Long> hset = new HashSet<>();
|
||||
|
||||
DenseLongMap dmap = new DenseLongMap(512);
|
||||
for (int i = 0; i < mapputs; i++) {
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
<exclude name="OverrideBothEqualsAndHashcode" />
|
||||
<exclude name="PreserveStackTrace" />
|
||||
<exclude name="ReturnEmptyCollectionRatherThanNull" />
|
||||
<exclude name="SimplifyBooleanReturns" />
|
||||
<exclude name="UncommentedEmptyConstructor" />
|
||||
<exclude name="UncommentedEmptyMethodBody" />
|
||||
<exclude name="UnusedFormalParameter" />
|
||||
|
@ -45,18 +46,11 @@
|
|||
<exclude name="FormalParameterNamingConventions" />
|
||||
<exclude name="LocalVariableNamingConventions" />
|
||||
<exclude name="MethodNamingConventions" />
|
||||
|
||||
<!-- Temporary -->
|
||||
<exclude name="ClassWithOnlyPrivateConstructorsShouldBeFinal" />
|
||||
<exclude name="LooseCoupling" />
|
||||
<exclude name="SimplifyBooleanReturns" />
|
||||
<exclude name="SingularField" />
|
||||
<exclude name="UnnecessaryFullyQualifiedName" />
|
||||
</rule>
|
||||
|
||||
<!-- Rules similar to Android Studio code inspection default settings -->
|
||||
<!-- <rule ref="category/java/bestpractices.xml/UnusedAssignment" /> -->
|
||||
<!-- <rule ref="category/java/codestyle.xml/UseDiamondOperator" /> -->
|
||||
<rule ref="category/java/codestyle.xml/UseDiamondOperator" />
|
||||
<!-- <rule ref="category/java/design.xml/ImmutableField" /> -->
|
||||
<!-- Will be added in PMD 7 -->
|
||||
<!-- <rule ref="category/java/codestyle.xml/UnnecessaryBoxing" /> -->
|
||||
|
|
Loading…
Reference in a new issue