Enable PMD rule UseDiamondOperator and fix violations

This commit is contained in:
Manuel Fuhr 2023-05-09 22:06:55 +02:00
parent 2e1722150c
commit 7a6d3bd9d9
45 changed files with 105 additions and 105 deletions

View file

@ -22,9 +22,9 @@ public class CompactMapTest {
private void hashMapComparison(int mapsize, int trycount) {
Random rand = new Random(12345);
HashMap<Long, String> hmap = new HashMap<Long, String>();
CompactLongMap<String> cmap_slow = new CompactLongMap<String>();
CompactLongMap<String> cmap_fast = new CompactLongMap<String>();
HashMap<Long, String> hmap = new HashMap<>();
CompactLongMap<String> cmap_slow = new CompactLongMap<>();
CompactLongMap<String> cmap_fast = new CompactLongMap<>();
for (int i = 0; i < mapsize; i++) {
String s = "" + i;
@ -40,8 +40,8 @@ public class CompactMapTest {
for (int i = 0; i < trycount * 2; i++) {
if (i == trycount) {
cmap_slow = new FrozenLongMap<String>(cmap_slow);
cmap_fast = new FrozenLongMap<String>(cmap_fast);
cmap_slow = new FrozenLongMap<>(cmap_slow);
cmap_fast = new FrozenLongMap<>(cmap_fast);
}
long k = mapsize < 10 ? i : rand.nextInt(20000);
Long KK = new Long(k);

View file

@ -22,7 +22,7 @@ public class CompactSetTest {
private void hashSetComparison(int setsize, int trycount) {
Random rand = new Random(12345);
HashSet<Long> hset = new HashSet<Long>();
HashSet<Long> hset = new HashSet<>();
CompactLongSet cset_slow = new CompactLongSet();
CompactLongSet cset_fast = new CompactLongSet();

View file

@ -16,7 +16,7 @@ public class DenseLongMapTest {
private void hashMapComparison(int mapsize, int trycount, long keyrange) {
Random rand = new Random(12345);
HashMap<Long, Integer> hmap = new HashMap<Long, Integer>();
HashMap<Long, Integer> hmap = new HashMap<>();
DenseLongMap dmap = new DenseLongMap(512);
for (int i = 0; i < mapsize; i++) {
@ -48,7 +48,7 @@ public class DenseLongMapTest {
int trycount = 100000;
Random rand = new Random(12345);
HashSet<Long> hset = new HashSet<Long>();
HashSet<Long> hset = new HashSet<>();
DenseLongMap dmap = new DenseLongMap(512);
for (int i = 0; i < mapputs; i++) {

View file

@ -8,7 +8,7 @@ import java.util.Random;
public class SortedHeapTest {
@Test
public void sortedHeapTest1() {
SortedHeap<String> sh = new SortedHeap<String>();
SortedHeap<String> sh = new SortedHeap<>();
Random rnd = new Random();
for (int i = 0; i < 100000; i++) {
int val = rnd.nextInt(1000000);
@ -34,7 +34,7 @@ public class SortedHeapTest {
@Test
public void sortedHeapTest2() {
SortedHeap<String> sh = new SortedHeap<String>();
SortedHeap<String> sh = new SortedHeap<>();
Random rnd = new Random();
for (int i = 0; i < 100000; i++) {
sh.add(i, "" + i);