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

@ -17,7 +17,7 @@ import java.util.List;
* @author ab
*/
public class DenseLongMap {
private List<byte[]> blocklist = new ArrayList<byte[]>(4096);
private List<byte[]> blocklist = new ArrayList<>(4096);
private int blocksize; // bytes per bitplane in one block
private int blocksizeBits;

View file

@ -20,7 +20,7 @@ public class FrozenLongMap<V> extends CompactLongMap<V> {
size = map.size();
faid = new long[size];
flv = new ArrayList<V>(size);
flv = new ArrayList<>(size);
map.moveToFrozenArrays(faid, flv);

View file

@ -13,7 +13,7 @@ public class LazyArrayOfLists<E> {
private List<ArrayList<E>> lists;
public LazyArrayOfLists(int size) {
lists = new ArrayList<ArrayList<E>>(size);
lists = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
lists.add(null);
}
@ -22,7 +22,7 @@ public class LazyArrayOfLists<E> {
public List<E> getList(int idx) {
ArrayList<E> list = lists.get(idx);
if (list == null) {
list = new ArrayList<E>();
list = new ArrayList<>();
lists.set(idx, list);
}
return list;

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);