This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-collections.git
The following commit(s) were added to refs/heads/master by this push: new 1d26ffd Remove redundant generic type arguments. 1d26ffd is described below commit 1d26ffda9302433fda227c5724d2f5cd499b0148 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Jan 26 17:23:41 2020 -0500 Remove redundant generic type arguments. --- .../bloomfilter/CountingBloomFilter.java | 12 +++++------ .../bloomfilter/HasherBloomFilter.java | 4 ++-- .../bloomfilter/hasher/DynamicHasher.java | 4 ++-- .../bloomfilter/hasher/StaticHasher.java | 2 +- .../collections4/bag/TransformedSortedBagTest.java | 2 +- .../bloomfilter/AbstractBloomFilterTest.java | 2 +- .../bloomfilter/CountingBloomFilterTest.java | 24 +++++++++++----------- .../bloomfilter/hasher/CommonComparatorTest.java | 4 ++-- .../bloomfilter/hasher/DeepComparatorTest.java | 4 ++-- .../bloomfilter/hasher/StaticHasherTest.java | 2 +- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java b/src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java index e8dc80d..c4dceb1 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java @@ -61,8 +61,8 @@ public class CountingBloomFilter extends AbstractBloomFilter { public CountingBloomFilter(Hasher hasher, Shape shape) { super(shape); verifyHasher(hasher); - counts = new TreeMap<Integer, Integer>(); - Set<Integer> idxs = new HashSet<Integer>(); + counts = new TreeMap<>(); + Set<Integer> idxs = new HashSet<>(); hasher.getBits(shape).forEachRemaining((IntConsumer) idxs::add); idxs.stream().forEach(idx -> counts.put(idx, 1)); } @@ -74,7 +74,7 @@ public class CountingBloomFilter extends AbstractBloomFilter { */ public CountingBloomFilter(Shape shape) { super(shape); - this.counts = new TreeMap<Integer, Integer>(); + this.counts = new TreeMap<>(); } /** @@ -111,7 +111,7 @@ public class CountingBloomFilter extends AbstractBloomFilter { */ public Stream<Map.Entry<Integer, Integer>> getCounts() { return counts.entrySet().stream() - .map(e -> new AbstractMap.SimpleEntry<Integer, Integer>(e.getKey(), e.getValue())); + .map(e -> new AbstractMap.SimpleEntry<>(e.getKey(), e.getValue())); } @Override @@ -200,7 +200,7 @@ public class CountingBloomFilter extends AbstractBloomFilter { */ public void remove(Hasher hasher) { verifyHasher( hasher ); - Set<Integer> lst = new HashSet<Integer>(); + Set<Integer> lst = new HashSet<>(); hasher.getBits(getShape()).forEachRemaining( (Consumer<Integer>)lst::add ); remove(lst.stream()); } @@ -262,7 +262,7 @@ public class CountingBloomFilter extends AbstractBloomFilter { @Override public int andCardinality(BloomFilter other) { if (other instanceof CountingBloomFilter) { - Set<Integer> result = new HashSet<Integer>( counts.keySet()); + Set<Integer> result = new HashSet<>( counts.keySet()); result.retainAll( ((CountingBloomFilter)other).counts.keySet() ); return result.size(); } diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilter.java b/src/main/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilter.java index fb2722a..3c0fb8c 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilter.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilter.java @@ -112,7 +112,7 @@ public class HasherBloomFilter extends AbstractBloomFilter { @Override public void merge(Hasher hasher) { verifyHasher(hasher); - IteratorChain<Integer> iter = new IteratorChain<Integer>(this.hasher.getBits(getShape()), + IteratorChain<Integer> iter = new IteratorChain<>(this.hasher.getBits(getShape()), hasher.getBits(getShape())); this.hasher = new StaticHasher(iter, getShape()); } @@ -125,7 +125,7 @@ public class HasherBloomFilter extends AbstractBloomFilter { @Override public boolean contains(Hasher hasher) { verifyHasher(hasher); - Set<Integer> set = new TreeSet<Integer>(); + Set<Integer> set = new TreeSet<>(); hasher.getBits(getShape()).forEachRemaining((IntConsumer) idx -> { set.add(idx); }); diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasher.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasher.java index aa60779..59e813c 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasher.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasher.java @@ -46,7 +46,7 @@ public class DynamicHasher implements Hasher { * @param buffers the byte buffers that will be hashed. */ public DynamicHasher(HashFunction function, List<byte[]> buffers) { - this.buffers = new ArrayList<byte[]>(buffers); + this.buffers = new ArrayList<>(buffers); this.function = function; } @@ -143,7 +143,7 @@ public class DynamicHasher implements Hasher { */ public Builder(HashFunction function) { this.function = function; - this.buffers = new ArrayList<byte[]>(); + this.buffers = new ArrayList<>(); } diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasher.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasher.java index ccc6c83..b14cf40 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasher.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasher.java @@ -79,7 +79,7 @@ public final class StaticHasher implements Hasher { */ public StaticHasher(Iterator<Integer> iter, Shape shape) { this.shape = shape; - Set<Integer> workingValues = new TreeSet<Integer>(); + Set<Integer> workingValues = new TreeSet<>(); iter.forEachRemaining( idx -> { if (idx >= this.shape.getNumberOfBits()) { diff --git a/src/test/java/org/apache/commons/collections4/bag/TransformedSortedBagTest.java b/src/test/java/org/apache/commons/collections4/bag/TransformedSortedBagTest.java index a3949ef..65b1ce1 100644 --- a/src/test/java/org/apache/commons/collections4/bag/TransformedSortedBagTest.java +++ b/src/test/java/org/apache/commons/collections4/bag/TransformedSortedBagTest.java @@ -64,7 +64,7 @@ public class TransformedSortedBagTest<T> extends AbstractSortedBagTest<T> { } public void testTransformedBag_decorateTransform() { - final TreeBag<T> originalBag = new TreeBag<T>(); + final TreeBag<T> originalBag = new TreeBag<>(); final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; for (final Object el : els) { originalBag.add((T) el); diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java index a1d10af..8d2935d 100644 --- a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java +++ b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java @@ -377,7 +377,7 @@ public abstract class AbstractBloomFilterTest { AbstractBloomFilter filter = createEmptyFilter(shape); assertFalse(filter.isFull()); - List<Integer> values = new ArrayList<Integer>(shape.getNumberOfBits()); + List<Integer> values = new ArrayList<>(shape.getNumberOfBits()); for (int i = 0; i < shape.getNumberOfBits(); i++) { values.add(i); } diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilterTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilterTest.java index c74dab9..527acf4 100644 --- a/src/test/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilterTest.java +++ b/src/test/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilterTest.java @@ -72,7 +72,7 @@ public class CountingBloomFilterTest extends AbstractBloomFilterTest { */ @Test public void ConstructorTest_Map_CountsTest() { - Map<Integer,Integer> map = new HashMap<Integer,Integer>(); + Map<Integer,Integer> map = new HashMap<>(); for (int i =0;i<17;i++) { map.put( i, 1 ); @@ -137,7 +137,7 @@ public class CountingBloomFilterTest extends AbstractBloomFilterTest { assertEquals(Integer.valueOf(2), bf.getCounts().map(Map.Entry::getValue).max(Integer::compare).get()); assertEquals(Integer.valueOf(1), bf.getCounts().map(Map.Entry::getValue).min(Integer::compare).get()); - Map<Integer, Integer> m = new HashMap<Integer, Integer>(); + Map<Integer, Integer> m = new HashMap<>(); bf.getCounts().forEach(e -> m.put(e.getKey(), e.getValue())); for (int i=0;i<29;i++) { @@ -177,7 +177,7 @@ public class CountingBloomFilterTest extends AbstractBloomFilterTest { assertEquals(Integer.valueOf(2), bf.getCounts().map(Map.Entry::getValue).max(Integer::compare).get()); assertEquals(Integer.valueOf(1), bf.getCounts().map(Map.Entry::getValue).min(Integer::compare).get()); - Map<Integer, Integer> m = new HashMap<Integer, Integer>(); + Map<Integer, Integer> m = new HashMap<>(); bf.getCounts().forEach(e -> m.put(e.getKey(), e.getValue())); for (int i=0;i<29;i++) { @@ -217,7 +217,7 @@ public class CountingBloomFilterTest extends AbstractBloomFilterTest { assertEquals(Integer.valueOf(2), bf.getCounts().map(Map.Entry::getValue).max(Integer::compare).get()); assertEquals(Integer.valueOf(1), bf.getCounts().map(Map.Entry::getValue).min(Integer::compare).get()); - Map<Integer, Integer> m = new HashMap<Integer, Integer>(); + Map<Integer, Integer> m = new HashMap<>(); bf.getCounts().forEach(e -> m.put(e.getKey(), e.getValue())); for (int i=0;i<29;i++) { @@ -243,7 +243,7 @@ public class CountingBloomFilterTest extends AbstractBloomFilterTest { CountingBloomFilter bf = createFilter(hasher, shape); - Map<Integer,Integer> map = new HashMap<Integer,Integer>(); + Map<Integer,Integer> map = new HashMap<>(); bf.getCounts().forEach( e -> map.put( e.getKey(), e.getValue())); map.put(1, Integer.MAX_VALUE ); @@ -276,7 +276,7 @@ public class CountingBloomFilterTest extends AbstractBloomFilterTest { 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; - Map<Integer,Integer> map = new HashMap<Integer,Integer>(); + Map<Integer,Integer> map = new HashMap<>(); for (int i=1;i<values.length;i++) { map.put( i, values[i] ); @@ -290,7 +290,7 @@ public class CountingBloomFilterTest extends AbstractBloomFilterTest { bf.remove( bf2 ); assertEquals( 17, bf.cardinality() ); - Map<Integer,Integer> map2 = new HashMap<Integer,Integer>(); + Map<Integer,Integer> map2 = new HashMap<>(); bf.getCounts().forEach( e -> map2.put( e.getKey(), e.getValue())); for (int i = 11; i<values.length; i++ ) @@ -311,7 +311,7 @@ public class CountingBloomFilterTest extends AbstractBloomFilterTest { 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; - Map<Integer,Integer> map = new HashMap<Integer,Integer>(); + Map<Integer,Integer> map = new HashMap<>(); for (int i=1;i<values.length;i++) { map.put( i, values[i] ); @@ -325,7 +325,7 @@ public class CountingBloomFilterTest extends AbstractBloomFilterTest { bf.remove( bf2 ); assertEquals( 17, bf.cardinality() ); - Map<Integer,Integer> map2 = new HashMap<Integer,Integer>(); + Map<Integer,Integer> map2 = new HashMap<>(); bf.getCounts().forEach( e -> map2.put( e.getKey(), e.getValue())); for (int i = 11; i<values.length; i++ ) @@ -348,7 +348,7 @@ public class CountingBloomFilterTest extends AbstractBloomFilterTest { CountingBloomFilter bf = createFilter(hasher, shape); - Map<Integer,Integer> map = new HashMap<Integer,Integer>(); + Map<Integer,Integer> map = new HashMap<>(); bf.getCounts().forEach( e -> map.put( e.getKey(), e.getValue())); map.remove(1); @@ -381,7 +381,7 @@ public class CountingBloomFilterTest extends AbstractBloomFilterTest { 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; - Map<Integer,Integer> map = new HashMap<Integer,Integer>(); + Map<Integer,Integer> map = new HashMap<>(); for (int i=1;i<values.length;i++) { map.put( i, values[i] ); @@ -395,7 +395,7 @@ public class CountingBloomFilterTest extends AbstractBloomFilterTest { bf.remove( hasher ); assertEquals( 17, bf.cardinality() ); - Map<Integer,Integer> map2 = new HashMap<Integer,Integer>(); + Map<Integer,Integer> map2 = new HashMap<>(); bf.getCounts().forEach( e -> map2.put( e.getKey(), e.getValue())); for (int i = 11; i<values.length; i++ ) diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/CommonComparatorTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/CommonComparatorTest.java index 8594599..e0cee37 100644 --- a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/CommonComparatorTest.java +++ b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/CommonComparatorTest.java @@ -124,9 +124,9 @@ public class CommonComparatorTest { @Test public void testSortOrder() { // in this test the signature is the position in the final collection for the ID - TreeSet<HashFunctionIdentity> result = new TreeSet<HashFunctionIdentity>( + TreeSet<HashFunctionIdentity> result = new TreeSet<>( HashFunctionIdentity.COMMON_COMPARATOR); - List<HashFunctionIdentity> collection = new ArrayList<HashFunctionIdentity>(); + List<HashFunctionIdentity> collection = new ArrayList<>(); collection .add(new HashFunctionIdentityImpl("Testing Suite", "impl1", Signedness.SIGNED, ProcessType.CYCLIC, 0)); diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DeepComparatorTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DeepComparatorTest.java index d25aded..f1534e2 100644 --- a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DeepComparatorTest.java +++ b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DeepComparatorTest.java @@ -127,8 +127,8 @@ public class DeepComparatorTest { @Test public void testSortOrder() { // in this test the signature is the position in the final collection for the ID - TreeSet<HashFunctionIdentity> result = new TreeSet<HashFunctionIdentity>(HashFunctionIdentity.DEEP_COMPARATOR); - List<HashFunctionIdentity> collection = new ArrayList<HashFunctionIdentity>(); + TreeSet<HashFunctionIdentity> result = new TreeSet<>(HashFunctionIdentity.DEEP_COMPARATOR); + List<HashFunctionIdentity> collection = new ArrayList<>(); collection .add(new HashFunctionIdentityImpl("Testing Suite", "impl1", Signedness.SIGNED, ProcessType.CYCLIC, 0)); diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasherTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasherTest.java index 29e038d..034bf8a 100644 --- a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasherTest.java +++ b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasherTest.java @@ -325,7 +325,7 @@ public class StaticHasherTest { */ @Test public void testIsEmpty() { - List<Integer> lst = new ArrayList<Integer>(); + List<Integer> lst = new ArrayList<>(); StaticHasher hasher = new StaticHasher(lst.iterator(), shape);