diff --git a/src/main/java/org/apache/commons/collections4/map/MultiValueMap.java b/src/main/java/org/apache/commons/collections4/map/MultiValueMap.java index af73df4b12..796f1b39be 100644 --- a/src/main/java/org/apache/commons/collections4/map/MultiValueMap.java +++ b/src/main/java/org/apache/commons/collections4/map/MultiValueMap.java @@ -134,7 +134,7 @@ public static > MultiValueMap multiValueMap( */ @SuppressWarnings({ "unchecked", "rawtypes" }) public MultiValueMap() { - this(new HashMap(), new ReflectionFactory(ArrayList.class)); + this(new HashMap<>(), new ReflectionFactory(ArrayList.class)); } /** diff --git a/src/main/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMap.java b/src/main/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMap.java index bc6b2700ad..0cc6a3718e 100644 --- a/src/main/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMap.java +++ b/src/main/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMap.java @@ -89,7 +89,7 @@ public ArrayListValuedHashMap(final int initialListCapacity) { * @param initialListCapacity the initial capacity used for value collections */ public ArrayListValuedHashMap(final int initialMapCapacity, final int initialListCapacity) { - super(new HashMap>(initialMapCapacity)); + super(new HashMap<>(initialMapCapacity)); this.initialListCapacity = initialListCapacity; } @@ -135,7 +135,7 @@ private void writeObject(final ObjectOutputStream oos) throws IOException { private void readObject(final ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject(); - setMap(new HashMap>()); + setMap(new HashMap<>()); doReadObject(ois); } diff --git a/src/main/java/org/apache/commons/collections4/multimap/HashSetValuedHashMap.java b/src/main/java/org/apache/commons/collections4/multimap/HashSetValuedHashMap.java index f6b8c16894..993defe1fb 100644 --- a/src/main/java/org/apache/commons/collections4/multimap/HashSetValuedHashMap.java +++ b/src/main/java/org/apache/commons/collections4/multimap/HashSetValuedHashMap.java @@ -88,7 +88,7 @@ public HashSetValuedHashMap(final int initialSetCapacity) { * @param initialSetCapacity the initial capacity used for value collections */ public HashSetValuedHashMap(final int initialMapCapacity, final int initialSetCapacity) { - super(new HashMap>(initialMapCapacity)); + super(new HashMap<>(initialMapCapacity)); this.initialSetCapacity = initialSetCapacity; } @@ -124,7 +124,7 @@ private void writeObject(final ObjectOutputStream oos) throws IOException { private void readObject(final ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject(); - setMap(new HashMap>()); + setMap(new HashMap<>()); doReadObject(ois); } diff --git a/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java b/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java index dd89d26d34..f34021c340 100644 --- a/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java @@ -262,7 +262,7 @@ public void testSwitchClosure() { assertEquals(1, c.count); assertEquals(NOPClosure.INSTANCE, ClosureUtils.switchClosure(new Predicate[0], new Closure[0])); - assertEquals(NOPClosure.INSTANCE, ClosureUtils.switchClosure(new HashMap, Closure>())); + assertEquals(NOPClosure.INSTANCE, ClosureUtils.switchClosure(new HashMap<>())); map.clear(); map.put(null, null); assertEquals(NOPClosure.INSTANCE, ClosureUtils.switchClosure(map)); @@ -309,7 +309,7 @@ public void testSwitchMapClosure() { assertEquals(0, b.count); assertEquals(1, c.count); - assertEquals(NOPClosure.INSTANCE, ClosureUtils.switchMapClosure(new HashMap>())); + assertEquals(NOPClosure.INSTANCE, ClosureUtils.switchMapClosure(new HashMap<>())); assertThrows(NullPointerException.class, () -> ClosureUtils.switchMapClosure(null)); } diff --git a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java index de4480ec40..03d4fbe9dd 100644 --- a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java @@ -313,12 +313,12 @@ public void collect() { assertCollectResult(collection); ArrayList list; - list = CollectionUtils.collect(collectionA, transformer, new ArrayList()); + list = CollectionUtils.collect(collectionA, transformer, new ArrayList<>()); assertEquals(list.size(), collectionA.size()); assertCollectResult(list); Iterator iterator = null; - list = CollectionUtils.collect(iterator, transformer, new ArrayList()); + list = CollectionUtils.collect(iterator, transformer, new ArrayList<>()); iterator = iterableA.iterator(); list = CollectionUtils.collect(iterator, transformer, list); @@ -1023,7 +1023,7 @@ private void next(final Iterator iterator, final T t) { @Test public void predicatedCollection() { final Predicate predicate = PredicateUtils.instanceofPredicate(Integer.class); - final Collection collection = CollectionUtils.predicatedCollection(new ArrayList(), predicate); + final Collection collection = CollectionUtils.predicatedCollection(new ArrayList<>(), predicate); assertTrue(collection instanceof PredicatedCollection, "returned object should be a PredicatedCollection"); } @@ -1047,7 +1047,7 @@ public void select() { // Ensure that the collection is the input type or a super type final Collection output1 = CollectionUtils.select(list, EQUALS_TWO); final Collection output2 = CollectionUtils.select(list, EQUALS_TWO); - final HashSet output3 = CollectionUtils.select(list, EQUALS_TWO, new HashSet()); + final HashSet output3 = CollectionUtils.select(list, EQUALS_TWO, new HashSet<>()); assertTrue(CollectionUtils.isEqualCollection(output1, output3)); assertEquals(4, list.size()); assertEquals(1, output1.size()); @@ -1063,7 +1063,7 @@ public void selectRejected() { list.add(4L); final Collection output1 = CollectionUtils.selectRejected(list, EQUALS_TWO); final Collection output2 = CollectionUtils.selectRejected(list, EQUALS_TWO); - final HashSet output3 = CollectionUtils.selectRejected(list, EQUALS_TWO, new HashSet()); + final HashSet output3 = CollectionUtils.selectRejected(list, EQUALS_TWO, new HashSet<>()); assertTrue(CollectionUtils.isEqualCollection(output1, output2)); assertTrue(CollectionUtils.isEqualCollection(output1, output3)); assertEquals(4, list.size()); diff --git a/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java b/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java index 657d0bf20f..4a844b36f1 100644 --- a/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java @@ -432,7 +432,7 @@ public void testToString() { String result = IterableUtils.toString(iterableA); assertEquals("[1, 2, 2, 3, 3, 3, 4, 4, 4, 4]", result); - result = IterableUtils.toString(new ArrayList()); + result = IterableUtils.toString(new ArrayList<>()); assertEquals("[]", result); result = IterableUtils.toString(null); @@ -441,7 +441,7 @@ public void testToString() { result = IterableUtils.toString(iterableA, input -> Integer.toString(input * 2)); assertEquals("[2, 4, 4, 6, 6, 6, 8, 8, 8, 8]", result); - result = IterableUtils.toString(new ArrayList(), input -> { + result = IterableUtils.toString(new ArrayList<>(), input -> { fail("not supposed to reach here"); return ""; }); @@ -480,10 +480,10 @@ public void testToStringDelimiter() { result = IterableUtils.toString(iterableA, transformer, ",,", "((", "))"); assertEquals("((2,,4,,4,,6,,6,,6,,8,,8,,8,,8))", result); - result = IterableUtils.toString(new ArrayList(), transformer, "", "(", ")"); + result = IterableUtils.toString(new ArrayList<>(), transformer, "", "(", ")"); assertEquals("()", result); - result = IterableUtils.toString(new ArrayList(), transformer, "", "", ""); + result = IterableUtils.toString(new ArrayList<>(), transformer, "", "", ""); assertEquals("", result); } @@ -495,20 +495,20 @@ public void testToStringWithNullArguments() { }, "", "(", ")"); assertEquals("()", result); assertAll( - () -> assertThrows(NullPointerException.class, () -> IterableUtils.toString(new ArrayList(), null, "", "(", ")"), + () -> assertThrows(NullPointerException.class, () -> IterableUtils.toString(new ArrayList<>(), null, "", "(", ")"), "expecting NullPointerException"), () -> assertThrows(NullPointerException.class, () -> - IterableUtils.toString(new ArrayList(), input -> { + IterableUtils.toString(new ArrayList<>(), input -> { fail("not supposed to reach here"); return ""; }, null, "(", ")"), "expecting NullPointerException"), - () -> assertThrows(NullPointerException.class, () -> IterableUtils.toString(new ArrayList(), input -> { + () -> assertThrows(NullPointerException.class, () -> IterableUtils.toString(new ArrayList<>(), input -> { fail("not supposed to reach here"); return ""; }, "", null, ")"), "expecting NullPointerException"), - () -> assertThrows(NullPointerException.class, () -> IterableUtils.toString(new ArrayList(), input -> { + () -> assertThrows(NullPointerException.class, () -> IterableUtils.toString(new ArrayList<>(), input -> { fail("not supposed to reach here"); return ""; }, "", "(", null), diff --git a/src/test/java/org/apache/commons/collections4/ListUtilsTest.java b/src/test/java/org/apache/commons/collections4/ListUtilsTest.java index 9ddb18c06b..00d5f58219 100644 --- a/src/test/java/org/apache/commons/collections4/ListUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/ListUtilsTest.java @@ -209,7 +209,7 @@ public void testIntersectNonEmptyWithEmptyList() { @Test public void testLazyFactoryList() { - final List list = ListUtils.lazyList(new ArrayList(), new Factory() { + final List list = ListUtils.lazyList(new ArrayList<>(), new Factory() { private int index; @@ -406,7 +406,7 @@ public void testSelect() { // Ensure that the collection is the input type or a super type final List output1 = ListUtils.select(list, EQUALS_TWO); final List output2 = ListUtils.select(list, EQUALS_TWO); - final HashSet output3 = CollectionUtils.select(list, EQUALS_TWO, new HashSet()); + final HashSet output3 = CollectionUtils.select(list, EQUALS_TWO, new HashSet<>()); assertTrue(CollectionUtils.isEqualCollection(output1, output3)); assertEquals(4, list.size()); assertEquals(1, output1.size()); @@ -423,7 +423,7 @@ public void testSelectRejected() { list.add(4L); final List output1 = ListUtils.selectRejected(list, EQUALS_TWO); final List output2 = ListUtils.selectRejected(list, EQUALS_TWO); - final HashSet output3 = CollectionUtils.selectRejected(list, EQUALS_TWO, new HashSet()); + final HashSet output3 = CollectionUtils.selectRejected(list, EQUALS_TWO, new HashSet<>()); assertTrue(CollectionUtils.isEqualCollection(output1, output2)); assertTrue(CollectionUtils.isEqualCollection(output1, output3)); assertEquals(4, list.size()); diff --git a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java index 66b61c71d7..b81539a38d 100644 --- a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java @@ -32,7 +32,6 @@ import java.text.NumberFormat; import java.util.AbstractMap; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -167,11 +166,11 @@ public void testPutAll_Map_array() { () -> assertThrows(NullPointerException.class, () -> MapUtils.putAll(null, new Object[0])) ); - Map test = MapUtils.putAll(new HashMap(), org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY); + Map test = MapUtils.putAll(new HashMap<>(), org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY); assertEquals(0, test.size()); // sub array - test = MapUtils.putAll(new HashMap(), new String[][] { + test = MapUtils.putAll(new HashMap<>(), new String[][] { {"RED", "#FF0000"}, {"GREEN", "#00FF00"}, {"BLUE", "#0000FF"} @@ -184,17 +183,17 @@ public void testPutAll_Map_array() { assertEquals("#0000FF", test.get("BLUE")); assertEquals(3, test.size()); assertAll( - () -> assertThrows(IllegalArgumentException.class, () -> MapUtils.putAll(new HashMap(), new String[][]{ + () -> assertThrows(IllegalArgumentException.class, () -> MapUtils.putAll(new HashMap<>(), new String[][]{ {"RED", "#FF0000"}, null, {"BLUE", "#0000FF"} })), - () -> assertThrows(IllegalArgumentException.class, () -> MapUtils.putAll(new HashMap(), new String[][]{ + () -> assertThrows(IllegalArgumentException.class, () -> MapUtils.putAll(new HashMap<>(), new String[][]{ {"RED", "#FF0000"}, {"GREEN"}, {"BLUE", "#0000FF"} })), - () -> assertThrows(IllegalArgumentException.class, () -> MapUtils.putAll(new HashMap(), new String[][]{ + () -> assertThrows(IllegalArgumentException.class, () -> MapUtils.putAll(new HashMap<>(), new String[][]{ {"RED", "#FF0000"}, {}, {"BLUE", "#0000FF"} @@ -202,7 +201,7 @@ public void testPutAll_Map_array() { ); // flat array - test = MapUtils.putAll(new HashMap(), new String[] { + test = MapUtils.putAll(new HashMap<>(), new String[] { "RED", "#FF0000", "GREEN", "#00FF00", "BLUE", "#0000FF" @@ -215,7 +214,7 @@ public void testPutAll_Map_array() { assertEquals("#0000FF", test.get("BLUE")); assertEquals(3, test.size()); - test = MapUtils.putAll(new HashMap(), new String[] { + test = MapUtils.putAll(new HashMap<>(), new String[] { "RED", "#FF0000", "GREEN", "#00FF00", "BLUE", "#0000FF", @@ -229,11 +228,11 @@ public void testPutAll_Map_array() { assertEquals("#0000FF", test.get("BLUE")); assertEquals(3, test.size()); - test = MapUtils.putAll(new HashMap(), null); + test = MapUtils.putAll(new HashMap<>(), null); assertEquals(0, test.size()); // map entry - test = MapUtils.putAll(new HashMap(), new Object[] { + test = MapUtils.putAll(new HashMap<>(), new Object[] { new DefaultMapEntry<>("RED", "#FF0000"), new DefaultMapEntry<>("GREEN", "#00FF00"), new DefaultMapEntry<>("BLUE", "#0000FF") @@ -247,7 +246,7 @@ public void testPutAll_Map_array() { assertEquals(3, test.size()); // key value - test = MapUtils.putAll(new HashMap(), new Object[] { + test = MapUtils.putAll(new HashMap<>(), new Object[] { new DefaultKeyValue<>("RED", "#FF0000"), new DefaultKeyValue<>("GREEN", "#00FF00"), new DefaultKeyValue<>("BLUE", "#0000FF") @@ -826,7 +825,7 @@ public void testPopulateMultiMap() { list.add(new X(5, "x5")); // Now test key transform population - final MultiValueMap map = MultiValueMap.multiValueMap(new TreeMap>()); + final MultiValueMap map = MultiValueMap.multiValueMap(new TreeMap<>()); MapUtils.populateMap(map, list, (Transformer) input -> input.key, TransformerUtils.nopTransformer()); assertEquals(list.size(), map.totalSize()); @@ -991,7 +990,7 @@ public void testFixedSizeMap() { @Test public void testFixedSizeSortedMap() { - final Exception exception = assertThrows(IllegalArgumentException.class, () -> MapUtils.fixedSizeSortedMap(new TreeMap()).put(1L, 1L)); + final Exception exception = assertThrows(IllegalArgumentException.class, () -> MapUtils.fixedSizeSortedMap(new TreeMap<>()).put(1L, 1L)); } @Test diff --git a/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java b/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java index c5a75c0bcf..7dfd82ed4e 100644 --- a/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java @@ -233,7 +233,7 @@ public void testSwitchTransformer() { assertEquals("C", TransformerUtils.switchTransformer(map).transform("WELL")); assertEquals(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchTransformer(new Predicate[0], new Transformer[0])); - assertEquals(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchTransformer(new HashMap, Transformer>())); + assertEquals(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchTransformer(new HashMap<>())); map = new HashMap<>(); map.put(null, null); assertEquals(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchTransformer(map)); @@ -263,7 +263,7 @@ public void testSwitchMapTransformer() { map.put(null, c); assertEquals("C", TransformerUtils.switchMapTransformer(map).transform("WELL")); - assertSame(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchMapTransformer(new HashMap>())); + assertSame(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchMapTransformer(new HashMap<>())); map = new HashMap<>(); map.put(null, null); assertSame(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchMapTransformer(map)); diff --git a/src/test/java/org/apache/commons/collections4/bag/CollectionBagTest.java b/src/test/java/org/apache/commons/collections4/bag/CollectionBagTest.java index 2834422d9c..d88cb81264 100644 --- a/src/test/java/org/apache/commons/collections4/bag/CollectionBagTest.java +++ b/src/test/java/org/apache/commons/collections4/bag/CollectionBagTest.java @@ -49,7 +49,7 @@ public CollectionBagTest() { @Override public Bag makeObject() { - return CollectionBag.collectionBag(new HashBag()); + return CollectionBag.collectionBag(new HashBag<>()); } /** diff --git a/src/test/java/org/apache/commons/collections4/bag/CollectionSortedBagTest.java b/src/test/java/org/apache/commons/collections4/bag/CollectionSortedBagTest.java index e3ee772e62..e65c2db8d5 100644 --- a/src/test/java/org/apache/commons/collections4/bag/CollectionSortedBagTest.java +++ b/src/test/java/org/apache/commons/collections4/bag/CollectionSortedBagTest.java @@ -58,7 +58,7 @@ public boolean isNullSupported() { @Override public Bag makeObject() { - return CollectionSortedBag.collectionSortedBag(new TreeBag()); + return CollectionSortedBag.collectionSortedBag(new TreeBag<>()); } /** diff --git a/src/test/java/org/apache/commons/collections4/bag/PredicatedBagTest.java b/src/test/java/org/apache/commons/collections4/bag/PredicatedBagTest.java index b37d0b8ed2..6379f464f2 100644 --- a/src/test/java/org/apache/commons/collections4/bag/PredicatedBagTest.java +++ b/src/test/java/org/apache/commons/collections4/bag/PredicatedBagTest.java @@ -52,11 +52,11 @@ protected Bag decorateBag(final HashBag bag, final Predicate predicate) @Override public Bag makeObject() { - return decorateBag(new HashBag(), truePredicate); + return decorateBag(new HashBag<>(), truePredicate); } protected Bag makeTestBag() { - return decorateBag(new HashBag(), stringPredicate()); + return decorateBag(new HashBag<>(), stringPredicate()); } @Override @@ -104,7 +104,7 @@ public void testIllegalDecorate() { assertThrows(IllegalArgumentException.class, () -> decorateBag((HashBag) elements, stringPredicate())); - assertThrows(NullPointerException.class, () -> decorateBag(new HashBag(), null)); + assertThrows(NullPointerException.class, () -> decorateBag(new HashBag<>(), null)); } @Override diff --git a/src/test/java/org/apache/commons/collections4/bag/PredicatedSortedBagTest.java b/src/test/java/org/apache/commons/collections4/bag/PredicatedSortedBagTest.java index 1362c85070..5d3b7cb566 100644 --- a/src/test/java/org/apache/commons/collections4/bag/PredicatedSortedBagTest.java +++ b/src/test/java/org/apache/commons/collections4/bag/PredicatedSortedBagTest.java @@ -53,19 +53,19 @@ protected SortedBag decorateBag(final SortedBag bag, final Predicate pr @Override public SortedBag makeObject() { - return decorateBag(new TreeBag(), truePredicate); + return decorateBag(new TreeBag<>(), truePredicate); } protected SortedBag makeTestBag() { - return decorateBag(new TreeBag(), stringPredicate()); + return decorateBag(new TreeBag<>(), stringPredicate()); } @Test public void testDecorate() { - final SortedBag bag = decorateBag(new TreeBag(), stringPredicate()); + final SortedBag bag = decorateBag(new TreeBag<>(), stringPredicate()); ((PredicatedSortedBag) bag).decorated(); - assertThrows(NullPointerException.class, () -> decorateBag(new TreeBag(), null)); + assertThrows(NullPointerException.class, () -> decorateBag(new TreeBag<>(), null)); assertThrows(NullPointerException.class, () -> decorateBag(nullBag, stringPredicate())); } @@ -73,7 +73,7 @@ public void testDecorate() { @Test @SuppressWarnings("unchecked") public void testSortOrder() { - final SortedBag bag = decorateBag(new TreeBag(), stringPredicate()); + final SortedBag bag = decorateBag(new TreeBag<>(), stringPredicate()); final String one = "one"; final String two = "two"; final String three = "three"; diff --git a/src/test/java/org/apache/commons/collections4/bag/SynchronizedBagTest.java b/src/test/java/org/apache/commons/collections4/bag/SynchronizedBagTest.java index 20a14a8753..5777ef2ea6 100644 --- a/src/test/java/org/apache/commons/collections4/bag/SynchronizedBagTest.java +++ b/src/test/java/org/apache/commons/collections4/bag/SynchronizedBagTest.java @@ -33,7 +33,7 @@ public SynchronizedBagTest() { @Override public Bag makeObject() { - return SynchronizedBag.synchronizedBag(new HashBag()); + return SynchronizedBag.synchronizedBag(new HashBag<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/bag/TransformedBagTest.java b/src/test/java/org/apache/commons/collections4/bag/TransformedBagTest.java index ea7fc8558d..08cf707f80 100644 --- a/src/test/java/org/apache/commons/collections4/bag/TransformedBagTest.java +++ b/src/test/java/org/apache/commons/collections4/bag/TransformedBagTest.java @@ -40,7 +40,7 @@ public TransformedBagTest() { @Override @SuppressWarnings("unchecked") public Bag makeObject() { - return TransformedBag.transformingBag(new HashBag(), + return TransformedBag.transformingBag(new HashBag<>(), (Transformer) TransformedCollectionTest.NOOP_TRANSFORMER); } @@ -53,7 +53,7 @@ protected int getIterationBehaviour() { @SuppressWarnings("unchecked") public void testTransformedBag() { //T had better be Object! - final Bag bag = TransformedBag.transformingBag(new HashBag(), + final Bag bag = TransformedBag.transformingBag(new HashBag<>(), (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); assertTrue(bag.isEmpty()); final Object[] els = {"1", "3", "5", "7", "2", "4", "6"}; 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 ebac0fedea..e6399488c1 100644 --- a/src/test/java/org/apache/commons/collections4/bag/TransformedSortedBagTest.java +++ b/src/test/java/org/apache/commons/collections4/bag/TransformedSortedBagTest.java @@ -39,13 +39,13 @@ public TransformedSortedBagTest() { @Override @SuppressWarnings("unchecked") public SortedBag makeObject() { - return TransformedSortedBag.transformingSortedBag(new TreeBag(), (Transformer) TransformedCollectionTest.NOOP_TRANSFORMER); + return TransformedSortedBag.transformingSortedBag(new TreeBag<>(), (Transformer) TransformedCollectionTest.NOOP_TRANSFORMER); } @Test @SuppressWarnings("unchecked") public void testTransformedBag() { - final SortedBag bag = TransformedSortedBag.transformingSortedBag(new TreeBag(), (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); + final SortedBag bag = TransformedSortedBag.transformingSortedBag(new TreeBag<>(), (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, bag.size()); final Object[] els = {"1", "3", "5", "7", "2", "4", "6"}; for (int i = 0; i < els.length; i++) { diff --git a/src/test/java/org/apache/commons/collections4/bag/UnmodifiableBagTest.java b/src/test/java/org/apache/commons/collections4/bag/UnmodifiableBagTest.java index 24625c643f..73eb45edf9 100644 --- a/src/test/java/org/apache/commons/collections4/bag/UnmodifiableBagTest.java +++ b/src/test/java/org/apache/commons/collections4/bag/UnmodifiableBagTest.java @@ -41,7 +41,7 @@ public UnmodifiableBagTest() { @Override public Bag makeObject() { - return UnmodifiableBag.unmodifiableBag(new HashBag()); + return UnmodifiableBag.unmodifiableBag(new HashBag<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/bag/UnmodifiableSortedBagTest.java b/src/test/java/org/apache/commons/collections4/bag/UnmodifiableSortedBagTest.java index f5153dee57..6a7a8667c1 100644 --- a/src/test/java/org/apache/commons/collections4/bag/UnmodifiableSortedBagTest.java +++ b/src/test/java/org/apache/commons/collections4/bag/UnmodifiableSortedBagTest.java @@ -41,7 +41,7 @@ public UnmodifiableSortedBagTest() { @Override public SortedBag makeObject() { - return UnmodifiableSortedBag.unmodifiableSortedBag(new TreeBag()); + return UnmodifiableSortedBag.unmodifiableSortedBag(new TreeBag<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecoratorTest.java b/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecoratorTest.java index 99e5401f45..48048b1342 100644 --- a/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecoratorTest.java +++ b/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecoratorTest.java @@ -70,7 +70,7 @@ private static final class TestOrderedBidiMap extends AbstractOrderedBidiM private TestOrderedBidiMap inverse = null; TestOrderedBidiMap() { - super(new DualTreeBidiMap()); + super(new DualTreeBidiMap<>()); } TestOrderedBidiMap(final OrderedBidiMap map) { diff --git a/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableBidiMapTest.java b/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableBidiMapTest.java index 3fbac8976c..cdb3b8859b 100644 --- a/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableBidiMapTest.java +++ b/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableBidiMapTest.java @@ -39,7 +39,7 @@ public UnmodifiableBidiMapTest() { @Override public BidiMap makeObject() { - return UnmodifiableBidiMap.unmodifiableBidiMap(new DualHashBidiMap()); + return UnmodifiableBidiMap.unmodifiableBidiMap(new DualHashBidiMap<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMapTest.java b/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMapTest.java index cd5782ddf2..9c78113139 100644 --- a/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMapTest.java +++ b/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMapTest.java @@ -38,7 +38,7 @@ public UnmodifiableOrderedBidiMapTest() { @Override public OrderedBidiMap makeObject() { - return UnmodifiableOrderedBidiMap.unmodifiableOrderedBidiMap(new TreeBidiMap()); + return UnmodifiableOrderedBidiMap.unmodifiableOrderedBidiMap(new TreeBidiMap<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMapTest.java b/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMapTest.java index 2a27da1eae..eb209a0ce9 100644 --- a/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMapTest.java +++ b/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMapTest.java @@ -38,7 +38,7 @@ public UnmodifiableSortedBidiMapTest() { @Override public SortedBidiMap makeObject() { - return UnmodifiableSortedBidiMap.unmodifiableSortedBidiMap(new DualTreeBidiMap()); + return UnmodifiableSortedBidiMap.unmodifiableSortedBidiMap(new DualTreeBidiMap<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/collection/IndexedCollectionTest.java b/src/test/java/org/apache/commons/collections4/collection/IndexedCollectionTest.java index be52285817..cf96770746 100644 --- a/src/test/java/org/apache/commons/collections4/collection/IndexedCollectionTest.java +++ b/src/test/java/org/apache/commons/collections4/collection/IndexedCollectionTest.java @@ -61,7 +61,7 @@ public Integer transform(final String input) { @Override public Collection makeObject() { - return decorateCollection(new ArrayList()); + return decorateCollection(new ArrayList<>()); } @Override @@ -90,11 +90,11 @@ public Collection makeConfirmedFullCollection() { } public Collection makeTestCollection() { - return decorateCollection(new ArrayList()); + return decorateCollection(new ArrayList<>()); } public Collection makeUniqueTestCollection() { - return decorateUniqueCollection(new ArrayList()); + return decorateUniqueCollection(new ArrayList<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionTest.java b/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionTest.java index 296a30a723..b259237be5 100644 --- a/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionTest.java +++ b/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionTest.java @@ -49,7 +49,7 @@ protected Collection decorateCollection( @Override public Collection makeObject() { - return decorateCollection(new ArrayList(), truePredicate); + return decorateCollection(new ArrayList<>(), truePredicate); } @Override @@ -78,7 +78,7 @@ public Collection makeConfirmedFullCollection() { o -> o instanceof String; public Collection makeTestCollection() { - return decorateCollection(new ArrayList(), testPredicate); + return decorateCollection(new ArrayList<>(), testPredicate); } @Test diff --git a/src/test/java/org/apache/commons/collections4/collection/SynchronizedCollectionTest.java b/src/test/java/org/apache/commons/collections4/collection/SynchronizedCollectionTest.java index 75f46507db..b7a1846823 100644 --- a/src/test/java/org/apache/commons/collections4/collection/SynchronizedCollectionTest.java +++ b/src/test/java/org/apache/commons/collections4/collection/SynchronizedCollectionTest.java @@ -34,7 +34,7 @@ public SynchronizedCollectionTest() { @Override public Collection makeObject() { - return SynchronizedCollection.synchronizedCollection(new ArrayList()); + return SynchronizedCollection.synchronizedCollection(new ArrayList<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/collection/UnmodifiableBoundedCollectionTest.java b/src/test/java/org/apache/commons/collections4/collection/UnmodifiableBoundedCollectionTest.java index 1a43fd155c..719ade667f 100644 --- a/src/test/java/org/apache/commons/collections4/collection/UnmodifiableBoundedCollectionTest.java +++ b/src/test/java/org/apache/commons/collections4/collection/UnmodifiableBoundedCollectionTest.java @@ -41,7 +41,7 @@ public UnmodifiableBoundedCollectionTest() { @Override public Collection makeObject() { - final BoundedCollection coll = FixedSizeList.fixedSizeList(new ArrayList()); + final BoundedCollection coll = FixedSizeList.fixedSizeList(new ArrayList<>()); return UnmodifiableBoundedCollection.unmodifiableBoundedCollection(coll); } diff --git a/src/test/java/org/apache/commons/collections4/collection/UnmodifiableCollectionTest.java b/src/test/java/org/apache/commons/collections4/collection/UnmodifiableCollectionTest.java index df0ed77aea..57b1913ea0 100644 --- a/src/test/java/org/apache/commons/collections4/collection/UnmodifiableCollectionTest.java +++ b/src/test/java/org/apache/commons/collections4/collection/UnmodifiableCollectionTest.java @@ -42,7 +42,7 @@ public UnmodifiableCollectionTest() { @Override public Collection makeObject() { - return UnmodifiableCollection.unmodifiableCollection(new ArrayList()); + return UnmodifiableCollection.unmodifiableCollection(new ArrayList<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/comparators/ReverseComparatorTest.java b/src/test/java/org/apache/commons/collections4/comparators/ReverseComparatorTest.java index e485a8d9be..11f9a6d89b 100644 --- a/src/test/java/org/apache/commons/collections4/comparators/ReverseComparatorTest.java +++ b/src/test/java/org/apache/commons/collections4/comparators/ReverseComparatorTest.java @@ -81,7 +81,7 @@ public List getComparableObjectsOrdered() { @Test @Override public void testSerializeDeserializeThenCompare() throws Exception { - final Comparator comp = new ReverseComparator<>(new ComparableComparator()); + final Comparator comp = new ReverseComparator<>(new ComparableComparator<>()); final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); final ObjectOutputStream out = new ObjectOutputStream(buffer); diff --git a/src/test/java/org/apache/commons/collections4/functors/ComparatorPredicateTest.java b/src/test/java/org/apache/commons/collections4/functors/ComparatorPredicateTest.java index 90cc57c04a..49603dd478 100644 --- a/src/test/java/org/apache/commons/collections4/functors/ComparatorPredicateTest.java +++ b/src/test/java/org/apache/commons/collections4/functors/ComparatorPredicateTest.java @@ -36,7 +36,7 @@ public int compare(final T first, final T second) { @Test public void compareEquals() { final Integer value = Integer.valueOf(10); - final Predicate p = comparatorPredicate(value, new TestComparator()); + final Predicate p = comparatorPredicate(value, new TestComparator<>()); assertPredicateFalse(p, Integer.valueOf(value.intValue() - 1)); assertPredicateTrue(p, Integer.valueOf(value.intValue())); assertPredicateFalse(p, Integer.valueOf(value.intValue() + 1)); @@ -45,7 +45,7 @@ public void compareEquals() { @Test public void compareGreater() { final Integer value = Integer.valueOf(10); - final Predicate p = comparatorPredicate(value, new TestComparator(), Criterion.GREATER); + final Predicate p = comparatorPredicate(value, new TestComparator<>(), Criterion.GREATER); assertPredicateTrue(p, Integer.valueOf(value.intValue() - 1)); assertPredicateFalse(p, Integer.valueOf(value.intValue())); assertPredicateFalse(p, Integer.valueOf(value.intValue() + 1)); @@ -54,7 +54,7 @@ public void compareGreater() { @Test public void compareLess() { final Integer value = Integer.valueOf(10); - final Predicate p = comparatorPredicate(value, new TestComparator(), Criterion.LESS); + final Predicate p = comparatorPredicate(value, new TestComparator<>(), Criterion.LESS); assertPredicateFalse(p, Integer.valueOf(value.intValue() - 1)); assertPredicateFalse(p, Integer.valueOf(value.intValue())); assertPredicateTrue(p, Integer.valueOf(value.intValue() + 1)); @@ -63,7 +63,7 @@ public void compareLess() { @Test public void compareGreaterOrEqual() { final Integer value = Integer.valueOf(10); - final Predicate p = comparatorPredicate(value, new TestComparator(), Criterion.GREATER_OR_EQUAL); + final Predicate p = comparatorPredicate(value, new TestComparator<>(), Criterion.GREATER_OR_EQUAL); assertPredicateTrue(p, Integer.valueOf(value.intValue() - 1)); assertPredicateTrue(p, Integer.valueOf(value.intValue())); assertPredicateFalse(p, Integer.valueOf(value.intValue() + 1)); @@ -72,7 +72,7 @@ public void compareGreaterOrEqual() { @Test public void compareLessOrEqual() { final Integer value = Integer.valueOf(10); - final Predicate p = comparatorPredicate(value, new TestComparator(), Criterion.LESS_OR_EQUAL); + final Predicate p = comparatorPredicate(value, new TestComparator<>(), Criterion.LESS_OR_EQUAL); assertPredicateFalse(p, Integer.valueOf(value.intValue() - 1)); assertPredicateTrue(p, Integer.valueOf(value.intValue())); assertPredicateTrue(p, Integer.valueOf(value.intValue() + 1)); @@ -80,6 +80,6 @@ public void compareLessOrEqual() { @Override protected Predicate generatePredicate() { - return comparatorPredicate(Integer.valueOf(10), new TestComparator()); + return comparatorPredicate(Integer.valueOf(10), new TestComparator<>()); } } diff --git a/src/test/java/org/apache/commons/collections4/iterators/CollatingIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/CollatingIteratorTest.java index a87147edc4..a1a112830a 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/CollatingIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/CollatingIteratorTest.java @@ -265,7 +265,7 @@ public void testNullComparator() { int i = 0; final CollatingIterator collatingIterator2 = new CollatingIterator<>(null, l1.iterator(), l2.iterator()); - collatingIterator2.setComparator(new ComparableComparator()); + collatingIterator2.setComparator(new ComparableComparator<>()); for ( ; collatingIterator2.hasNext(); i++ ) { final Integer n = collatingIterator2.next(); assertEquals((int) n, i + 1, "wrong order"); diff --git a/src/test/java/org/apache/commons/collections4/iterators/FilterIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/FilterIteratorTest.java index c91c399eeb..4d81b6b8e6 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/FilterIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/FilterIteratorTest.java @@ -75,7 +75,7 @@ public void tearDown() throws Exception { */ @Override public FilterIterator makeEmptyIterator() { - return makeBlockAllFilter(new ArrayIterator(array)); + return makeBlockAllFilter(new ArrayIterator<>(array)); } /** diff --git a/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java index 1be2aecb71..9ac73be842 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java @@ -185,7 +185,7 @@ public void testTruePredicate() { @Test public void testFalsePredicate() { final FilterListIterator filtered = new FilterListIterator<>(list.listIterator(), falsePred); - walkLists(new ArrayList(), filtered); + walkLists(new ArrayList<>(), filtered); } @Test diff --git a/src/test/java/org/apache/commons/collections4/iterators/PermutationIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/PermutationIteratorTest.java index be9c55a7e6..ac65d2e510 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/PermutationIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/PermutationIteratorTest.java @@ -66,7 +66,7 @@ public boolean supportsEmptyIterator() { @Override public PermutationIterator makeEmptyIterator() { - return new PermutationIterator<>(new ArrayList()); + return new PermutationIterator<>(new ArrayList<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/iterators/ReverseListIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/ReverseListIteratorTest.java index 1c51164fce..4973c803a4 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/ReverseListIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/ReverseListIteratorTest.java @@ -44,7 +44,7 @@ public ReverseListIteratorTest() { @Override public ListIterator makeEmptyIterator() { - return new ReverseListIterator<>(new ArrayList()); + return new ReverseListIterator<>(new ArrayList<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/list/FixedSizeListTest.java b/src/test/java/org/apache/commons/collections4/list/FixedSizeListTest.java index 857d9596b0..9ed6ab4c42 100644 --- a/src/test/java/org/apache/commons/collections4/list/FixedSizeListTest.java +++ b/src/test/java/org/apache/commons/collections4/list/FixedSizeListTest.java @@ -41,7 +41,7 @@ public FixedSizeListTest() { @Override public List makeObject() { - return FixedSizeList.fixedSizeList(new ArrayList()); + return FixedSizeList.fixedSizeList(new ArrayList<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/list/PredicatedListTest.java b/src/test/java/org/apache/commons/collections4/list/PredicatedListTest.java index f206bd3152..cc80cd366b 100644 --- a/src/test/java/org/apache/commons/collections4/list/PredicatedListTest.java +++ b/src/test/java/org/apache/commons/collections4/list/PredicatedListTest.java @@ -49,7 +49,7 @@ protected List decorateList(final List list, final Predicate predicate) @Override public List makeObject() { - return decorateList(new ArrayList(), truePredicate); + return decorateList(new ArrayList<>(), truePredicate); } @Override @@ -62,7 +62,7 @@ public E[] getFullElements() { o -> o instanceof String; public List makeTestList() { - return decorateList(new ArrayList(), testPredicate); + return decorateList(new ArrayList<>(), testPredicate); } @Test diff --git a/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java b/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java index b6327a7d08..3da6f6d720 100644 --- a/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java +++ b/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java @@ -91,13 +91,13 @@ public E[] getFullNonNullElements() { @Override public List makeObject() { - return new SetUniqueList<>(new ArrayList(), new HashSet()); + return new SetUniqueList<>(new ArrayList<>(), new HashSet<>()); } @Test @SuppressWarnings("unchecked") public void testAdd() { - final SetUniqueList lset = new SetUniqueList<>(new ArrayList(), new HashSet()); + final SetUniqueList lset = new SetUniqueList<>(new ArrayList<>(), new HashSet<>()); // Duplicate element final E obj = (E) Integer.valueOf(1); @@ -113,7 +113,7 @@ public void testAdd() { @Test @SuppressWarnings("unchecked") public void testAddAll() { - final SetUniqueList lset = new SetUniqueList<>(new ArrayList(), new HashSet()); + final SetUniqueList lset = new SetUniqueList<>(new ArrayList<>(), new HashSet<>()); lset.addAll( Arrays.asList((E[]) new Integer[] { Integer.valueOf(1), Integer.valueOf(1)})); @@ -210,7 +210,7 @@ public void testCollections307() { // repeat the test with a different class than HashSet; // which means subclassing SetUniqueList below list = new ArrayList<>(); - uniqueList = new SetUniqueList307(list, new TreeSet()); + uniqueList = new SetUniqueList307(list, new TreeSet<>()); uniqueList.add((E) hello); uniqueList.add((E) world); @@ -269,7 +269,7 @@ public void testFactory() { @Test public void testIntCollectionAddAll() { // make a SetUniqueList with one element - final List list = new SetUniqueList<>(new ArrayList(), new HashSet()); + final List list = new SetUniqueList<>(new ArrayList<>(), new HashSet<>()); final Integer existingElement = Integer.valueOf(1); list.add(existingElement); @@ -295,7 +295,7 @@ public void testIntCollectionAddAll() { @Test @SuppressWarnings("unchecked") public void testListIterator() { - final SetUniqueList lset = new SetUniqueList<>(new ArrayList(), new HashSet()); + final SetUniqueList lset = new SetUniqueList<>(new ArrayList<>(), new HashSet<>()); final E obj1 = (E) Integer.valueOf(1); final E obj2 = (E) Integer.valueOf(2); @@ -424,7 +424,7 @@ public void testRetainAllWithInitialList() { @Test @SuppressWarnings("unchecked") public void testSet() { - final SetUniqueList lset = new SetUniqueList<>(new ArrayList(), new HashSet()); + final SetUniqueList lset = new SetUniqueList<>(new ArrayList<>(), new HashSet<>()); // Duplicate element final E obj1 = (E) Integer.valueOf(1); @@ -463,7 +463,7 @@ public void testSet() { @Test public void testSetCollections444() { - final SetUniqueList lset = new SetUniqueList<>(new ArrayList(), new HashSet()); + final SetUniqueList lset = new SetUniqueList<>(new ArrayList<>(), new HashSet<>()); // Duplicate element final Integer obj1 = Integer.valueOf(1); @@ -594,7 +594,7 @@ public void testSubListIsUnmodifiable() { @Test @SuppressWarnings("unchecked") public void testUniqueListDoubleInsert() { - final List l = SetUniqueList.setUniqueList(new LinkedList()); + final List l = SetUniqueList.setUniqueList(new LinkedList<>()); l.add((E) new Object()); l.add((E) new Object()); @@ -610,7 +610,7 @@ public void testUniqueListDoubleInsert() { @Test @SuppressWarnings("unchecked") public void testUniqueListReInsert() { - final List l = SetUniqueList.setUniqueList(new LinkedList()); + final List l = SetUniqueList.setUniqueList(new LinkedList<>()); l.add((E) new Object()); l.add((E) new Object()); diff --git a/src/test/java/org/apache/commons/collections4/list/TransformedListTest.java b/src/test/java/org/apache/commons/collections4/list/TransformedListTest.java index a40ba1ab3b..f8791db714 100644 --- a/src/test/java/org/apache/commons/collections4/list/TransformedListTest.java +++ b/src/test/java/org/apache/commons/collections4/list/TransformedListTest.java @@ -56,7 +56,7 @@ public List makeConfirmedFullCollection() { @Override @SuppressWarnings("unchecked") public List makeObject() { - return TransformedList.transformingList(new ArrayList(), (Transformer) TransformedCollectionTest.NOOP_TRANSFORMER); + return TransformedList.transformingList(new ArrayList<>(), (Transformer) TransformedCollectionTest.NOOP_TRANSFORMER); } @Override @@ -69,7 +69,7 @@ public List makeFullCollection() { @Test @SuppressWarnings("unchecked") public void testTransformedList() { - final List list = TransformedList.transformingList(new ArrayList(), (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); + final List list = TransformedList.transformingList(new ArrayList<>(), (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, list.size()); final E[] els = (E[]) new Object[] {"1", "3", "5", "7", "2", "4", "6"}; for (int i = 0; i < els.length; i++) { diff --git a/src/test/java/org/apache/commons/collections4/list/UnmodifiableListTest.java b/src/test/java/org/apache/commons/collections4/list/UnmodifiableListTest.java index d1ea995528..7f8397d147 100644 --- a/src/test/java/org/apache/commons/collections4/list/UnmodifiableListTest.java +++ b/src/test/java/org/apache/commons/collections4/list/UnmodifiableListTest.java @@ -41,7 +41,7 @@ public UnmodifiableListTest() { @Override public UnmodifiableList makeObject() { - return new UnmodifiableList<>(new ArrayList()); + return new UnmodifiableList<>(new ArrayList<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java index 01f2d5a94d..06866838c7 100644 --- a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java @@ -949,13 +949,13 @@ public void testMapPutAll() { // check putAll OK adding empty map to empty map resetEmpty(); assertEquals(0, getMap().size()); - getMap().putAll(new HashMap()); + getMap().putAll(new HashMap<>()); assertEquals(0, getMap().size()); // check putAll OK adding empty map to non-empty map resetFull(); final int size = getMap().size(); - getMap().putAll(new HashMap()); + getMap().putAll(new HashMap<>()); assertEquals(size, getMap().size()); // check putAll OK adding non-empty map to empty map diff --git a/src/test/java/org/apache/commons/collections4/map/AbstractOrderedMapTest.java b/src/test/java/org/apache/commons/collections4/map/AbstractOrderedMapTest.java index a0f99c7615..67265a9a65 100644 --- a/src/test/java/org/apache/commons/collections4/map/AbstractOrderedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/AbstractOrderedMapTest.java @@ -71,7 +71,7 @@ public OrderedMap makeFullMap() { */ @Override public Map makeConfirmedMap() { - return new TreeMap<>(new NullComparator()); + return new TreeMap<>(new NullComparator<>()); } /** @@ -82,7 +82,7 @@ public Map makeConfirmedMap() { @SuppressWarnings("unchecked") public K[] getSampleKeys() { final List list = new ArrayList<>(Arrays.asList(super.getSampleKeys())); - list.sort(new NullComparator()); + list.sort(new NullComparator<>()); return (K[]) list.toArray(); } diff --git a/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java b/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java index ca6f5cb1bc..bbd56e9983 100644 --- a/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java @@ -51,8 +51,8 @@ public void setUp() throws Exception { @Override public CompositeMap makeObject() { final CompositeMap map = new CompositeMap<>(); - map.addComposited(new HashMap()); - map.setMutator( new EmptyMapMutator() ); + map.addComposited(new HashMap<>()); + map.setMutator( new EmptyMapMutator<>() ); return map; } diff --git a/src/test/java/org/apache/commons/collections4/map/FixedSizeMapTest.java b/src/test/java/org/apache/commons/collections4/map/FixedSizeMapTest.java index 5df607e019..589559c519 100644 --- a/src/test/java/org/apache/commons/collections4/map/FixedSizeMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/FixedSizeMapTest.java @@ -35,7 +35,7 @@ public FixedSizeMapTest() { @Override public IterableMap makeObject() { - return FixedSizeMap.fixedSizeMap(new HashMap()); + return FixedSizeMap.fixedSizeMap(new HashMap<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/map/FixedSizeSortedMapTest.java b/src/test/java/org/apache/commons/collections4/map/FixedSizeSortedMapTest.java index 9597a107e2..7311977228 100644 --- a/src/test/java/org/apache/commons/collections4/map/FixedSizeSortedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/FixedSizeSortedMapTest.java @@ -33,7 +33,7 @@ public FixedSizeSortedMapTest() { @Override public SortedMap makeObject() { - return FixedSizeSortedMap.fixedSizeSortedMap(new TreeMap()); + return FixedSizeSortedMap.fixedSizeSortedMap(new TreeMap<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/map/LazyMapTest.java b/src/test/java/org/apache/commons/collections4/map/LazyMapTest.java index e9798a2061..13311090db 100644 --- a/src/test/java/org/apache/commons/collections4/map/LazyMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/LazyMapTest.java @@ -46,7 +46,7 @@ public LazyMapTest() { @Override public LazyMap makeObject() { - return lazyMap(new HashMap(), FactoryUtils.nullFactory()); + return lazyMap(new HashMap<>(), FactoryUtils.nullFactory()); } @Test @@ -57,7 +57,7 @@ public void testMapGet() { @Test public void mapGetWithFactory() { - Map map = lazyMap(new HashMap(), oneFactory); + Map map = lazyMap(new HashMap<>(), oneFactory); assertEquals(0, map.size()); final Number i1 = map.get("Five"); assertEquals(1, i1); @@ -67,7 +67,7 @@ public void mapGetWithFactory() { assertEquals(1, map.size()); assertSame(i1, i2); - map = lazyMap(new HashMap(), FactoryUtils.nullFactory()); + map = lazyMap(new HashMap<>(), FactoryUtils.nullFactory()); final Object o = map.get("Five"); assertNull(o); assertEquals(1, map.size()); @@ -76,7 +76,7 @@ public void mapGetWithFactory() { @Test public void mapGetWithTransformer() { final Transformer intConverter = Number::intValue; - final Map map = lazyMap(new HashMap(), intConverter); + final Map map = lazyMap(new HashMap<>(), intConverter); assertEquals(0, map.size()); final Number i1 = map.get(123L); assertEquals(123, i1); diff --git a/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java b/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java index 3de7c0df7e..bc21d916a2 100644 --- a/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java @@ -64,7 +64,7 @@ public LazySortedMapTest() { @Override public SortedMap makeObject() { - return lazySortedMap(new TreeMap(), FactoryUtils.nullFactory()); + return lazySortedMap(new TreeMap<>(), FactoryUtils.nullFactory()); } @Override @@ -81,13 +81,13 @@ public void testMapGet() { @Test public void mapGet() { - Map map = lazySortedMap(new TreeMap(), oneFactory); + Map map = lazySortedMap(new TreeMap<>(), oneFactory); assertEquals(0, map.size()); final Number i1 = map.get(5); assertEquals(1, i1); assertEquals(1, map.size()); - map = lazySortedMap(new TreeMap(), FactoryUtils.nullFactory()); + map = lazySortedMap(new TreeMap<>(), FactoryUtils.nullFactory()); final Number o = map.get(5); assertNull(o); assertEquals(1, map.size()); @@ -96,7 +96,7 @@ public void mapGet() { @Test public void testSortOrder() { - final SortedMap map = lazySortedMap(new TreeMap(), oneFactory); + final SortedMap map = lazySortedMap(new TreeMap<>(), oneFactory); map.put("A", 5); map.get("B"); // Entry with value "One" created map.put("C", 8); @@ -115,7 +115,7 @@ public void testSortOrder() { @Test public void testReverseSortOrder() { - final SortedMap map = lazySortedMap(new ConcurrentSkipListMap(reverseStringComparator), oneFactory); + final SortedMap map = lazySortedMap(new ConcurrentSkipListMap<>(reverseStringComparator), oneFactory); map.put("A", 5); map.get("B"); // Entry with value "One" created map.put("C", 8); @@ -135,10 +135,10 @@ public void testReverseSortOrder() { @Test public void testTransformerDecorate() { final Transformer transformer = TransformerUtils.asTransformer(oneFactory); - final SortedMap map = lazySortedMap(new TreeMap(), transformer); + final SortedMap map = lazySortedMap(new TreeMap<>(), transformer); assertTrue(map instanceof LazySortedMap); assertAll( - () -> assertThrows(NullPointerException.class, () -> lazySortedMap(new TreeMap(), (Transformer) null), + () -> assertThrows(NullPointerException.class, () -> lazySortedMap(new TreeMap<>(), (Transformer) null), "Expecting NullPointerException for null transformer"), () -> assertThrows(NullPointerException.class, () -> lazySortedMap((SortedMap) null, transformer), "Expecting NullPointerException for null map") diff --git a/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java b/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java index 75e68733f3..8699c8f78c 100644 --- a/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java @@ -47,7 +47,7 @@ public ListOrderedMapTest() { @Override public ListOrderedMap makeObject() { - return ListOrderedMap.listOrderedMap(new HashMap()); + return ListOrderedMap.listOrderedMap(new HashMap<>()); } /** diff --git a/src/test/java/org/apache/commons/collections4/map/MultiKeyMapTest.java b/src/test/java/org/apache/commons/collections4/map/MultiKeyMapTest.java index 68014853d6..5dff8ff4dc 100644 --- a/src/test/java/org/apache/commons/collections4/map/MultiKeyMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/MultiKeyMapTest.java @@ -128,7 +128,7 @@ public void testNullHandling() { assertThrows(NullPointerException.class, () -> map.put(null, null)); - assertNull(map.put(new MultiKey(null, null), null)); + assertNull(map.put(new MultiKey<>(null, null), null)); assertThrows(NullPointerException.class, () -> map.put(null, (V) new Object())); } @@ -437,7 +437,7 @@ public void testClone() { @Test @SuppressWarnings("unchecked") public void testLRUMultiKeyMap() { - final MultiKeyMap map = MultiKeyMap.multiKeyMap(new LRUMap, V>(2)); + final MultiKeyMap map = MultiKeyMap.multiKeyMap(new LRUMap<>(2)); map.put((K) I1, (K) I2, (V) "1-2"); map.put((K) I1, (K) I3, (V) "1-1"); assertEquals(2, map.size()); diff --git a/src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java b/src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java index 262e40dde7..3283299bc8 100644 --- a/src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java @@ -126,7 +126,7 @@ private MultiValueMap createTestMap() { @SuppressWarnings("unchecked") private > MultiValueMap createTestMap(final Class collectionClass) { - final MultiValueMap map = MultiValueMap.multiValueMap(new HashMap(), collectionClass); + final MultiValueMap map = MultiValueMap.multiValueMap(new HashMap<>(), collectionClass); map.put((K) "one", (V) "uno"); map.put((K) "one", (V) "un"); map.put((K) "two", (V) "dos"); @@ -308,7 +308,7 @@ public void testContainsValue_Key() { @SuppressWarnings("unchecked") public void testPutWithList() { @SuppressWarnings("rawtypes") - final MultiValueMap test = MultiValueMap.multiValueMap(new HashMap(), ArrayList.class); + final MultiValueMap test = MultiValueMap.multiValueMap(new HashMap<>(), ArrayList.class); assertEquals("a", test.put((K) "A", "a")); assertEquals("b", test.put((K) "A", "b")); assertEquals(1, test.size()); @@ -320,7 +320,7 @@ public void testPutWithList() { @SuppressWarnings("unchecked") public void testPutWithSet() { @SuppressWarnings("rawtypes") - final MultiValueMap test = MultiValueMap.multiValueMap(new HashMap(), HashSet.class); + final MultiValueMap test = MultiValueMap.multiValueMap(new HashMap<>(), HashSet.class); assertEquals("a", test.put((K) "A", "a")); assertEquals("b", test.put((K) "A", "b")); assertNull(test.put((K) "A", "a")); @@ -392,7 +392,7 @@ public void testPutAll_KeyCollection() { assertTrue(map.containsValue("A", "Y")); assertTrue(map.containsValue("A", "Z")); - assertFalse(map.putAll((K) "A", new ArrayList())); + assertFalse(map.putAll((K) "A", new ArrayList<>())); assertEquals(3, map.size("A")); assertTrue(map.containsValue("A", "X")); assertTrue(map.containsValue("A", "Y")); @@ -419,7 +419,7 @@ public void testRemove_KeyItem() { assertTrue(map.removeMapping("A", "AC")); assertTrue(map.removeMapping("A", "AB")); assertTrue(map.removeMapping("A", "AA")); - assertEquals(new MultiValueMap(), map); + assertEquals(new MultiValueMap<>(), map); } @Test diff --git a/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java b/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java index c92f1286ae..3447e40d72 100644 --- a/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java @@ -191,12 +191,12 @@ public void testEntrySet() { @Test public void testExpiration() { - validateExpiration(new PassiveExpiringMap(500), 500); - validateExpiration(new PassiveExpiringMap(1000), 1000); + validateExpiration(new PassiveExpiringMap<>(500), 500); + validateExpiration(new PassiveExpiringMap<>(1000), 1000); validateExpiration(new PassiveExpiringMap<>( - new PassiveExpiringMap.ConstantTimeToLiveExpirationPolicy(500)), 500); + new PassiveExpiringMap.ConstantTimeToLiveExpirationPolicy<>(500)), 500); validateExpiration(new PassiveExpiringMap<>( - new PassiveExpiringMap.ConstantTimeToLiveExpirationPolicy(1, TimeUnit.SECONDS)), 1000); + new PassiveExpiringMap.ConstantTimeToLiveExpirationPolicy<>(1, TimeUnit.SECONDS)), 1000); } @Test diff --git a/src/test/java/org/apache/commons/collections4/map/PredicatedMapTest.java b/src/test/java/org/apache/commons/collections4/map/PredicatedMapTest.java index 65581fdc51..1b9968b859 100644 --- a/src/test/java/org/apache/commons/collections4/map/PredicatedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/PredicatedMapTest.java @@ -53,11 +53,11 @@ protected IterableMap decorateMap(final Map map, final Predicate makeObject() { - return decorateMap(new HashMap(), truePredicate, truePredicate); + return decorateMap(new HashMap<>(), truePredicate, truePredicate); } public IterableMap makeTestMap() { - return decorateMap(new HashMap(), testPredicate, testPredicate); + return decorateMap(new HashMap<>(), testPredicate, testPredicate); } @Test @@ -65,7 +65,7 @@ public IterableMap makeTestMap() { public void testEntrySet() { Map map = makeTestMap(); assertNotNull(map.entrySet(), "returned entryset should not be null"); - map = decorateMap(new HashMap(), null, null); + map = decorateMap(new HashMap<>(), null, null); map.put((K) "oneKey", (V) "oneValue"); assertEquals(1, map.entrySet().size(), "returned entryset should contain one entry"); map = decorateMap(map, null, null); diff --git a/src/test/java/org/apache/commons/collections4/map/PredicatedSortedMapTest.java b/src/test/java/org/apache/commons/collections4/map/PredicatedSortedMapTest.java index 887ca820b2..51e7d50c1a 100644 --- a/src/test/java/org/apache/commons/collections4/map/PredicatedSortedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/PredicatedSortedMapTest.java @@ -67,15 +67,15 @@ protected SortedMap decorateMap(final SortedMap map, final Predicate @Override public SortedMap makeObject() { - return decorateMap(new TreeMap(), truePredicate, truePredicate); + return decorateMap(new TreeMap<>(), truePredicate, truePredicate); } public SortedMap makeTestMap() { - return decorateMap(new TreeMap(), testPredicate, testPredicate); + return decorateMap(new TreeMap<>(), testPredicate, testPredicate); } public SortedMap makeTestMapWithComparator() { - return decorateMap(new ConcurrentSkipListMap(reverseStringComparator), testPredicate, testPredicate); + return decorateMap(new ConcurrentSkipListMap<>(reverseStringComparator), testPredicate, testPredicate); } @Override @@ -95,7 +95,7 @@ public boolean isAllowNullKey() { public void testEntrySet() { SortedMap map = makeTestMap(); assertNotNull(map.entrySet(), "returned entryset should not be null"); - map = decorateMap(new TreeMap(), null, null); + map = decorateMap(new TreeMap<>(), null, null); map.put((K) "oneKey", (V) "oneValue"); assertEquals(1, map.entrySet().size(), "returned entryset should contain one entry"); map = decorateMap(map, null, null); diff --git a/src/test/java/org/apache/commons/collections4/map/SingletonMapTest.java b/src/test/java/org/apache/commons/collections4/map/SingletonMapTest.java index 76c63062b9..44ebbaa7c6 100644 --- a/src/test/java/org/apache/commons/collections4/map/SingletonMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/SingletonMapTest.java @@ -43,7 +43,7 @@ public SingletonMapTest() { public OrderedMap makeObject() { // need an empty singleton map, but that's not possible // use a ridiculous fake instead to make the tests pass - return UnmodifiableOrderedMap.unmodifiableOrderedMap(ListOrderedMap.listOrderedMap(new HashMap())); + return UnmodifiableOrderedMap.unmodifiableOrderedMap(ListOrderedMap.listOrderedMap(new HashMap<>())); } @Override diff --git a/src/test/java/org/apache/commons/collections4/map/TransformedMapTest.java b/src/test/java/org/apache/commons/collections4/map/TransformedMapTest.java index 61d07121b2..697de04567 100644 --- a/src/test/java/org/apache/commons/collections4/map/TransformedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/TransformedMapTest.java @@ -45,7 +45,7 @@ public TransformedMapTest() { @Override public IterableMap makeObject() { - return TransformedMap.transformingMap(new HashMap(), TransformerUtils.nopTransformer(), + return TransformedMap.transformingMap(new HashMap<>(), TransformerUtils.nopTransformer(), TransformerUtils.nopTransformer()); } @@ -56,7 +56,7 @@ public void testTransformedMap() { Map map = TransformedMap .transformingMap( - new HashMap(), + new HashMap<>(), (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER, null); assertEquals(0, map.size()); diff --git a/src/test/java/org/apache/commons/collections4/map/TransformedSortedMapTest.java b/src/test/java/org/apache/commons/collections4/map/TransformedSortedMapTest.java index 59a23022fc..5a53e68314 100644 --- a/src/test/java/org/apache/commons/collections4/map/TransformedSortedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/TransformedSortedMapTest.java @@ -51,7 +51,7 @@ public String[] ignoredTests() { @Override @SuppressWarnings("unchecked") public SortedMap makeObject() { - return TransformedSortedMap.transformingSortedMap(new TreeMap(), + return TransformedSortedMap.transformingSortedMap(new TreeMap<>(), (Transformer) TransformerUtils.nopTransformer(), (Transformer) TransformerUtils.nopTransformer()); } @@ -69,7 +69,7 @@ public void testTransformedMap() { SortedMap map = TransformedSortedMap .transformingSortedMap( - new TreeMap(), + new TreeMap<>(), (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER, null); assertEquals(0, map.size()); @@ -90,7 +90,7 @@ public void testTransformedMap() { map = TransformedSortedMap .transformingSortedMap( - new TreeMap(), + new TreeMap<>(), null, (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, map.size()); diff --git a/src/test/java/org/apache/commons/collections4/map/UnmodifiableMapTest.java b/src/test/java/org/apache/commons/collections4/map/UnmodifiableMapTest.java index 74dc169382..fee8298076 100644 --- a/src/test/java/org/apache/commons/collections4/map/UnmodifiableMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/UnmodifiableMapTest.java @@ -41,7 +41,7 @@ public UnmodifiableMapTest() { @Override public IterableMap makeObject() { - return (IterableMap) UnmodifiableMap.unmodifiableMap(new HashMap()); + return (IterableMap) UnmodifiableMap.unmodifiableMap(new HashMap<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/map/UnmodifiableOrderedMapTest.java b/src/test/java/org/apache/commons/collections4/map/UnmodifiableOrderedMapTest.java index 3ba205f445..cfe4c393a8 100644 --- a/src/test/java/org/apache/commons/collections4/map/UnmodifiableOrderedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/UnmodifiableOrderedMapTest.java @@ -40,7 +40,7 @@ public UnmodifiableOrderedMapTest() { @Override public OrderedMap makeObject() { - return UnmodifiableOrderedMap.unmodifiableOrderedMap(ListOrderedMap.listOrderedMap(new HashMap())); + return UnmodifiableOrderedMap.unmodifiableOrderedMap(ListOrderedMap.listOrderedMap(new HashMap<>())); } @Override @@ -60,7 +60,7 @@ public boolean isRemoveSupported() { @Override public OrderedMap makeFullMap() { - final OrderedMap m = ListOrderedMap.listOrderedMap(new HashMap()); + final OrderedMap m = ListOrderedMap.listOrderedMap(new HashMap<>()); addSampleMappings(m); return UnmodifiableOrderedMap.unmodifiableOrderedMap(m); } diff --git a/src/test/java/org/apache/commons/collections4/map/UnmodifiableSortedMapTest.java b/src/test/java/org/apache/commons/collections4/map/UnmodifiableSortedMapTest.java index f485d814eb..df1a86ec5d 100644 --- a/src/test/java/org/apache/commons/collections4/map/UnmodifiableSortedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/UnmodifiableSortedMapTest.java @@ -40,7 +40,7 @@ public UnmodifiableSortedMapTest() { @Override public SortedMap makeObject() { - return UnmodifiableSortedMap.unmodifiableSortedMap(new TreeMap()); + return UnmodifiableSortedMap.unmodifiableSortedMap(new TreeMap<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java index e057cf8c6e..02f8ecd49f 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java @@ -660,7 +660,7 @@ public void testPutAll_KeyIterable() { assertTrue(map.containsMapping("A", "Y")); assertTrue(map.containsMapping("A", "Z")); - assertFalse(map.putAll((K) "A", new ArrayList())); + assertFalse(map.putAll((K) "A", new ArrayList<>())); assertEquals(3, map.get((K) "A").size()); assertTrue(map.containsMapping("A", "X")); assertTrue(map.containsMapping("A", "Y")); diff --git a/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java index 9a1acdf6c7..57f216b4fb 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java @@ -43,7 +43,7 @@ public TransformedMultiValuedMapTest() { @Override public MultiValuedMap makeObject() { - return TransformedMultiValuedMap.transformingMap(new ArrayListValuedHashMap(), + return TransformedMultiValuedMap.transformingMap(new ArrayListValuedHashMap<>(), TransformerUtils.nopTransformer(), TransformerUtils.nopTransformer()); } @@ -58,7 +58,7 @@ public void testKeyTransformedMap() { final Object[] els = { "1", "3", "5", "7", "2", "4", "6" }; final MultiValuedMap map = TransformedMultiValuedMap.transformingMap( - new ArrayListValuedHashMap(), + new ArrayListValuedHashMap<>(), (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER, null); assertEquals(0, map.size()); @@ -83,7 +83,7 @@ public void testValueTransformedMap() { final Object[] els = { "1", "3", "5", "7", "2", "4", "6" }; final MultiValuedMap map = TransformedMultiValuedMap.transformingMap( - new ArrayListValuedHashMap(), null, + new ArrayListValuedHashMap<>(), null, (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, map.size()); for (int i = 0; i < els.length; i++) { diff --git a/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java index 31c8e02002..d9d4b954d6 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java @@ -71,7 +71,7 @@ public boolean isRemoveSupported() { @Override public MultiValuedMap makeObject() { return UnmodifiableMultiValuedMap.unmodifiableMultiValuedMap( - new ArrayListValuedHashMap()); + new ArrayListValuedHashMap<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/multiset/PredicatedMultiSetTest.java b/src/test/java/org/apache/commons/collections4/multiset/PredicatedMultiSetTest.java index c7e2523f90..3f4a5bcac7 100644 --- a/src/test/java/org/apache/commons/collections4/multiset/PredicatedMultiSetTest.java +++ b/src/test/java/org/apache/commons/collections4/multiset/PredicatedMultiSetTest.java @@ -52,11 +52,11 @@ protected MultiSet decorateMultiSet(final HashMultiSet multiset, final Pre @Override public MultiSet makeObject() { - return decorateMultiSet(new HashMultiSet(), truePredicate); + return decorateMultiSet(new HashMultiSet<>(), truePredicate); } protected MultiSet makeTestMultiSet() { - return decorateMultiSet(new HashMultiSet(), stringPredicate()); + return decorateMultiSet(new HashMultiSet<>(), stringPredicate()); } @Override @@ -103,7 +103,7 @@ public void testIllegalDecorate() { elements.add("four"); assertThrows(IllegalArgumentException.class, () -> decorateMultiSet((HashMultiSet) elements, stringPredicate()), "MultiSet contains an element that should fail the predicate."); - assertThrows(NullPointerException.class, () -> decorateMultiSet(new HashMultiSet(), null), + assertThrows(NullPointerException.class, () -> decorateMultiSet(new HashMultiSet<>(), null), "Expecting NullPointerException for null predicate."); } diff --git a/src/test/java/org/apache/commons/collections4/multiset/SynchronizedMultiSetTest.java b/src/test/java/org/apache/commons/collections4/multiset/SynchronizedMultiSetTest.java index 1349aab932..0e8906c72b 100644 --- a/src/test/java/org/apache/commons/collections4/multiset/SynchronizedMultiSetTest.java +++ b/src/test/java/org/apache/commons/collections4/multiset/SynchronizedMultiSetTest.java @@ -32,7 +32,7 @@ public SynchronizedMultiSetTest() { @Override public MultiSet makeObject() { - return SynchronizedMultiSet.synchronizedMultiSet(new HashMultiSet()); + return SynchronizedMultiSet.synchronizedMultiSet(new HashMultiSet<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/multiset/UnmodifiableMultiSetTest.java b/src/test/java/org/apache/commons/collections4/multiset/UnmodifiableMultiSetTest.java index a3810422e3..162b662fab 100644 --- a/src/test/java/org/apache/commons/collections4/multiset/UnmodifiableMultiSetTest.java +++ b/src/test/java/org/apache/commons/collections4/multiset/UnmodifiableMultiSetTest.java @@ -40,7 +40,7 @@ public UnmodifiableMultiSetTest() { @Override public MultiSet makeObject() { - return UnmodifiableMultiSet.unmodifiableMultiSet(new HashMultiSet()); + return UnmodifiableMultiSet.unmodifiableMultiSet(new HashMultiSet<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/queue/PredicatedQueueTest.java b/src/test/java/org/apache/commons/collections4/queue/PredicatedQueueTest.java index 9ec51c6aa8..46ee5413b2 100644 --- a/src/test/java/org/apache/commons/collections4/queue/PredicatedQueueTest.java +++ b/src/test/java/org/apache/commons/collections4/queue/PredicatedQueueTest.java @@ -50,7 +50,7 @@ protected Queue decorateCollection(final Queue queue, final Predicate p @Override public Queue makeObject() { - return decorateCollection(new LinkedList(), truePredicate); + return decorateCollection(new LinkedList<>(), truePredicate); } @Override @@ -73,7 +73,7 @@ public Collection makeConfirmedFullCollection() { protected Predicate testPredicate = o -> o instanceof String; public Queue makeTestQueue() { - return decorateCollection(new LinkedList(), testPredicate); + return decorateCollection(new LinkedList<>(), testPredicate); } @Test diff --git a/src/test/java/org/apache/commons/collections4/queue/SynchronizedQueueTest.java b/src/test/java/org/apache/commons/collections4/queue/SynchronizedQueueTest.java index 00b7904617..8114b9d882 100644 --- a/src/test/java/org/apache/commons/collections4/queue/SynchronizedQueueTest.java +++ b/src/test/java/org/apache/commons/collections4/queue/SynchronizedQueueTest.java @@ -41,7 +41,7 @@ public String getCompatibilityVersion() { @Override public Queue makeObject() { - return SynchronizedQueue.synchronizedQueue(new LinkedList()); + return SynchronizedQueue.synchronizedQueue(new LinkedList<>()); } @Test diff --git a/src/test/java/org/apache/commons/collections4/queue/TransformedQueueTest.java b/src/test/java/org/apache/commons/collections4/queue/TransformedQueueTest.java index 6f9ec4065a..63fd424526 100644 --- a/src/test/java/org/apache/commons/collections4/queue/TransformedQueueTest.java +++ b/src/test/java/org/apache/commons/collections4/queue/TransformedQueueTest.java @@ -55,7 +55,7 @@ public Queue makeConfirmedFullCollection() { @Override @SuppressWarnings("unchecked") public Queue makeObject() { - return TransformedQueue.transformingQueue(new LinkedList(), + return TransformedQueue.transformingQueue(new LinkedList<>(), (Transformer) TransformedCollectionTest.NOOP_TRANSFORMER); } diff --git a/src/test/java/org/apache/commons/collections4/queue/UnmodifiableQueueTest.java b/src/test/java/org/apache/commons/collections4/queue/UnmodifiableQueueTest.java index 96ec176c26..8b213ed433 100644 --- a/src/test/java/org/apache/commons/collections4/queue/UnmodifiableQueueTest.java +++ b/src/test/java/org/apache/commons/collections4/queue/UnmodifiableQueueTest.java @@ -43,7 +43,7 @@ public UnmodifiableQueueTest() { @Override public Queue makeObject() { - return UnmodifiableQueue.unmodifiableQueue(new LinkedList()); + return UnmodifiableQueue.unmodifiableQueue(new LinkedList<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java b/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java index 9d27467761..97c8143ef7 100644 --- a/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java +++ b/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java @@ -118,7 +118,7 @@ public void testShadok() { List> shadokSentences = new ArrayList<>(); for (int lg=0; lg> newTab = new ArrayList<>(); - newTab.add(new ArrayList()); + newTab.add(new ArrayList<>()); for (final String element : shadokAlph) { for (final List sentence : shadokSentences) { final List newSentence = new ArrayList<>(sentence); diff --git a/src/test/java/org/apache/commons/collections4/set/ListOrderedSetTest.java b/src/test/java/org/apache/commons/collections4/set/ListOrderedSetTest.java index ae47a2142c..77d80e2822 100644 --- a/src/test/java/org/apache/commons/collections4/set/ListOrderedSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/ListOrderedSetTest.java @@ -55,7 +55,7 @@ public ListOrderedSetTest() { @Override public ListOrderedSet makeObject() { - return ListOrderedSet.listOrderedSet(new HashSet()); + return ListOrderedSet.listOrderedSet(new HashSet<>()); } @SuppressWarnings("unchecked") @@ -267,8 +267,8 @@ public void testDecorator() { () -> assertThrows(NullPointerException.class, () -> ListOrderedSet.listOrderedSet((List) null)), () -> assertThrows(NullPointerException.class, () -> ListOrderedSet.listOrderedSet((Set) null)), () -> assertThrows(NullPointerException.class, () -> ListOrderedSet.listOrderedSet(null, null)), - () -> assertThrows(NullPointerException.class, () -> ListOrderedSet.listOrderedSet(new HashSet(), null)), - () -> assertThrows(NullPointerException.class, () -> ListOrderedSet.listOrderedSet(null, new ArrayList())) + () -> assertThrows(NullPointerException.class, () -> ListOrderedSet.listOrderedSet(new HashSet<>(), null)), + () -> assertThrows(NullPointerException.class, () -> ListOrderedSet.listOrderedSet(null, new ArrayList<>())) ); } diff --git a/src/test/java/org/apache/commons/collections4/set/MapBackedSet2Test.java b/src/test/java/org/apache/commons/collections4/set/MapBackedSet2Test.java index ce6497b37a..524b93eef3 100644 --- a/src/test/java/org/apache/commons/collections4/set/MapBackedSet2Test.java +++ b/src/test/java/org/apache/commons/collections4/set/MapBackedSet2Test.java @@ -38,7 +38,7 @@ public MapBackedSet2Test() { @Override public Set makeObject() { - return MapBackedSet.mapBackedSet(new LinkedMap()); + return MapBackedSet.mapBackedSet(new LinkedMap<>()); } @SuppressWarnings("unchecked") diff --git a/src/test/java/org/apache/commons/collections4/set/MapBackedSetTest.java b/src/test/java/org/apache/commons/collections4/set/MapBackedSetTest.java index d9f720704f..660272beff 100644 --- a/src/test/java/org/apache/commons/collections4/set/MapBackedSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/MapBackedSetTest.java @@ -33,7 +33,7 @@ public MapBackedSetTest() { @Override public Set makeObject() { - return MapBackedSet.mapBackedSet(new HashedMap()); + return MapBackedSet.mapBackedSet(new HashedMap<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/set/PredicatedNavigableSetTest.java b/src/test/java/org/apache/commons/collections4/set/PredicatedNavigableSetTest.java index 8e32f1510a..52ed7974fd 100644 --- a/src/test/java/org/apache/commons/collections4/set/PredicatedNavigableSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/PredicatedNavigableSetTest.java @@ -47,7 +47,7 @@ public PredicatedNavigableSetTest() { @Override public NavigableSet makeObject() { - return PredicatedNavigableSet.predicatedNavigableSet(new TreeSet(), truePredicate); + return PredicatedNavigableSet.predicatedNavigableSet(new TreeSet<>(), truePredicate); } @Override @@ -60,7 +60,7 @@ public NavigableSet makeFullCollection() { o -> o instanceof String && ((String) o).startsWith("A"); protected PredicatedNavigableSet makeTestSet() { - return PredicatedNavigableSet.predicatedNavigableSet(new TreeSet(), testPredicate); + return PredicatedNavigableSet.predicatedNavigableSet(new TreeSet<>(), testPredicate); } @Test diff --git a/src/test/java/org/apache/commons/collections4/set/PredicatedSetTest.java b/src/test/java/org/apache/commons/collections4/set/PredicatedSetTest.java index e7722e4770..afba189e22 100644 --- a/src/test/java/org/apache/commons/collections4/set/PredicatedSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/PredicatedSetTest.java @@ -47,7 +47,7 @@ protected PredicatedSet decorateSet(final Set set, final Predicate makeObject() { - return decorateSet(new HashSet(), truePredicate); + return decorateSet(new HashSet<>(), truePredicate); } @Override @@ -60,7 +60,7 @@ public E[] getFullElements() { o -> o instanceof String; protected PredicatedSet makeTestSet() { - return decorateSet(new HashSet(), testPredicate); + return decorateSet(new HashSet<>(), testPredicate); } @Test diff --git a/src/test/java/org/apache/commons/collections4/set/PredicatedSortedSetTest.java b/src/test/java/org/apache/commons/collections4/set/PredicatedSortedSetTest.java index d5676ef7d2..a5e5df3f89 100644 --- a/src/test/java/org/apache/commons/collections4/set/PredicatedSortedSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/PredicatedSortedSetTest.java @@ -47,7 +47,7 @@ public PredicatedSortedSetTest() { @Override public SortedSet makeObject() { - return PredicatedSortedSet.predicatedSortedSet(new TreeSet(), truePredicate); + return PredicatedSortedSet.predicatedSortedSet(new TreeSet<>(), truePredicate); } @Override @@ -60,7 +60,7 @@ public SortedSet makeFullCollection() { o -> o instanceof String && ((String) o).startsWith("A"); protected PredicatedSortedSet makeTestSet() { - return PredicatedSortedSet.predicatedSortedSet(new TreeSet(), testPredicate); + return PredicatedSortedSet.predicatedSortedSet(new TreeSet<>(), testPredicate); } @Test diff --git a/src/test/java/org/apache/commons/collections4/set/TransformedNavigableSetTest.java b/src/test/java/org/apache/commons/collections4/set/TransformedNavigableSetTest.java index d2c8e04558..7734198e14 100644 --- a/src/test/java/org/apache/commons/collections4/set/TransformedNavigableSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/TransformedNavigableSetTest.java @@ -44,7 +44,7 @@ public TransformedNavigableSetTest() { @Override @SuppressWarnings("unchecked") public NavigableSet makeObject() { - return TransformedNavigableSet.transformingNavigableSet(new TreeSet(), + return TransformedNavigableSet.transformingNavigableSet(new TreeSet<>(), (Transformer) TransformedCollectionTest.NOOP_TRANSFORMER); } @@ -59,7 +59,7 @@ public NavigableSet makeFullCollection() { @Test @SuppressWarnings("unchecked") public void testTransformedSet() { - final NavigableSet set = TransformedNavigableSet.transformingNavigableSet(new TreeSet(), + final NavigableSet set = TransformedNavigableSet.transformingNavigableSet(new TreeSet<>(), (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, set.size()); final E[] els = (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" }; diff --git a/src/test/java/org/apache/commons/collections4/set/TransformedSetTest.java b/src/test/java/org/apache/commons/collections4/set/TransformedSetTest.java index 2708310743..05b4791ccd 100644 --- a/src/test/java/org/apache/commons/collections4/set/TransformedSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/TransformedSetTest.java @@ -54,7 +54,7 @@ public Set makeConfirmedFullCollection() { @Override @SuppressWarnings("unchecked") public Set makeObject() { - return TransformedSet.transformingSet(new HashSet(), + return TransformedSet.transformingSet(new HashSet<>(), (Transformer) TransformedCollectionTest.NOOP_TRANSFORMER); } @@ -69,7 +69,7 @@ public Set makeFullCollection() { @Test @SuppressWarnings("unchecked") public void testTransformedSet() { - final Set set = TransformedSet.transformingSet(new HashSet(), + final Set set = TransformedSet.transformingSet(new HashSet<>(), (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, set.size()); final E[] els = (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" }; diff --git a/src/test/java/org/apache/commons/collections4/set/TransformedSortedSetTest.java b/src/test/java/org/apache/commons/collections4/set/TransformedSortedSetTest.java index 8593ead4fe..faaf6ddecf 100644 --- a/src/test/java/org/apache/commons/collections4/set/TransformedSortedSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/TransformedSortedSetTest.java @@ -44,7 +44,7 @@ public TransformedSortedSetTest() { @Override @SuppressWarnings("unchecked") public SortedSet makeObject() { - return TransformedSortedSet.transformingSortedSet(new TreeSet(), (Transformer) TransformedCollectionTest.NOOP_TRANSFORMER); + return TransformedSortedSet.transformingSortedSet(new TreeSet<>(), (Transformer) TransformedCollectionTest.NOOP_TRANSFORMER); } @Override @@ -57,7 +57,7 @@ public SortedSet makeFullCollection() { @Test @SuppressWarnings("unchecked") public void testTransformedSet() { - final SortedSet set = TransformedSortedSet.transformingSortedSet(new TreeSet(), + final SortedSet set = TransformedSortedSet.transformingSortedSet(new TreeSet<>(), (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, set.size()); final E[] els = (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" }; diff --git a/src/test/java/org/apache/commons/collections4/set/UnmodifiableSetTest.java b/src/test/java/org/apache/commons/collections4/set/UnmodifiableSetTest.java index 93bff22ab4..42daccfea1 100644 --- a/src/test/java/org/apache/commons/collections4/set/UnmodifiableSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/UnmodifiableSetTest.java @@ -41,7 +41,7 @@ public UnmodifiableSetTest() { @Override public Set makeObject() { - return UnmodifiableSet.unmodifiableSet(new HashSet()); + return UnmodifiableSet.unmodifiableSet(new HashSet<>()); } @Override diff --git a/src/test/java/org/apache/commons/collections4/set/UnmodifiableSortedSetTest.java b/src/test/java/org/apache/commons/collections4/set/UnmodifiableSortedSetTest.java index 2a51ae1d0e..258e210977 100644 --- a/src/test/java/org/apache/commons/collections4/set/UnmodifiableSortedSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/UnmodifiableSortedSetTest.java @@ -46,7 +46,7 @@ public UnmodifiableSortedSetTest() { @Override public SortedSet makeObject() { - return UnmodifiableSortedSet.unmodifiableSortedSet(new TreeSet()); + return UnmodifiableSortedSet.unmodifiableSortedSet(new TreeSet<>()); } @Override @@ -101,7 +101,7 @@ public void verifyUnmodifiable(final Set set) { assertAll( () -> assertThrows(UnsupportedOperationException.class, () -> set.add((E) "value"), "Expecting UnsupportedOperationException."), - () -> assertThrows(UnsupportedOperationException.class, () -> set.addAll(new TreeSet()), + () -> assertThrows(UnsupportedOperationException.class, () -> set.addAll(new TreeSet<>()), "Expecting UnsupportedOperationException."), () -> assertThrows(UnsupportedOperationException.class, () -> set.clear(), "Expecting UnsupportedOperationException."), diff --git a/src/test/java/org/apache/commons/collections4/splitmap/TransformedSplitMapTest.java b/src/test/java/org/apache/commons/collections4/splitmap/TransformedSplitMapTest.java index 70e43b6441..a2458a3d5f 100644 --- a/src/test/java/org/apache/commons/collections4/splitmap/TransformedSplitMapTest.java +++ b/src/test/java/org/apache/commons/collections4/splitmap/TransformedSplitMapTest.java @@ -54,7 +54,7 @@ public TransformedSplitMapTest() { @Test public void testTransformedMap() { final TransformedSplitMap> map = TransformedSplitMap.transformingMap( - new HashMap>(), intToString, objectToClass); + new HashMap<>(), intToString, objectToClass); final Integer[] k = { 0, 1, 2, 3, 4, 5, 6 }; final Object[] v = { "", new Object(), new HashMap<>(), 0, BigInteger.TEN, null, @@ -78,7 +78,7 @@ public void testTransformedMap() { assertEquals(--sz, map.size()); final TransformedSplitMap map2 = TransformedSplitMap.transformingMap( - new HashMap(), NOPTransformer.nopTransformer(), stringToInt); + new HashMap<>(), NOPTransformer.nopTransformer(), stringToInt); assertEquals(0, map2.size()); for (int i = 0; i < 6; i++) { map2.put(String.valueOf(i), String.valueOf(i)); @@ -97,7 +97,7 @@ public void testTransformedMap() { @Test public void testMapIterator() { final TransformedSplitMap map = - TransformedSplitMap.transformingMap(new HashMap(), + TransformedSplitMap.transformingMap(new HashMap<>(), NOPTransformer.nopTransformer(), stringToInt); assertEquals(0, map.size()); for (int i = 0; i < 6; i++) { @@ -114,7 +114,7 @@ public void testMapIterator() { @Test public void testEmptyMap() throws IOException, ClassNotFoundException { final TransformedSplitMap map = - TransformedSplitMap.transformingMap(new HashMap(), + TransformedSplitMap.transformingMap(new HashMap<>(), NOPTransformer.nopTransformer(), NOPTransformer.nopTransformer() ); @@ -131,7 +131,7 @@ public void testEmptyMap() throws IOException, ClassNotFoundException { @Test public void testFullMap() throws IOException, ClassNotFoundException { final TransformedSplitMap map = TransformedSplitMap.transformingMap( - new HashMap(), + new HashMap<>(), NOPTransformer.nopTransformer(), NOPTransformer.nopTransformer() ); map.put( "a", "b" ); diff --git a/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java b/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java index 06a208ca62..06a6dc7c01 100755 --- a/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java +++ b/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java @@ -400,15 +400,15 @@ public void testPrefixMapClear() { public void testPrefixMapClearNothing() { final Trie trie = new PatriciaTrie<>(); final SortedMap prefixMap = trie.prefixMap("And"); - assertEquals(new HashSet(), prefixMap.keySet()); - assertEquals(new ArrayList(0), new ArrayList<>(prefixMap.values())); + assertEquals(new HashSet<>(), prefixMap.keySet()); + assertEquals(new ArrayList<>(0), new ArrayList<>(prefixMap.values())); prefixMap.clear(); assertTrue(prefixMap.isEmpty()); assertTrue(prefixMap.isEmpty()); assertTrue(prefixMap.isEmpty()); - assertEquals(new HashSet(), trie.keySet()); - assertEquals(new ArrayList(0), new ArrayList<>(trie.values())); + assertEquals(new HashSet<>(), trie.keySet()); + assertEquals(new ArrayList<>(0), new ArrayList<>(trie.values())); } @Test diff --git a/src/test/java/org/apache/commons/collections4/trie/UnmodifiableTrieTest.java b/src/test/java/org/apache/commons/collections4/trie/UnmodifiableTrieTest.java index db3bf3afaa..d09e27bd7b 100644 --- a/src/test/java/org/apache/commons/collections4/trie/UnmodifiableTrieTest.java +++ b/src/test/java/org/apache/commons/collections4/trie/UnmodifiableTrieTest.java @@ -39,7 +39,7 @@ public UnmodifiableTrieTest() { @Override public Trie makeObject() { - return UnmodifiableTrie.unmodifiableTrie(new PatriciaTrie()); + return UnmodifiableTrie.unmodifiableTrie(new PatriciaTrie<>()); } @Override