diff --git a/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java b/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java index eef6e9ede..906023d9d 100644 --- a/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java @@ -413,7 +413,7 @@ public class ClosureUtilsTest { */ @Test public void testSingletonPatternInSerialization() { - final Object[] singletons = new Object[] { + final Object[] singletons = { ExceptionClosure.INSTANCE, NOPClosure.INSTANCE, }; diff --git a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java index 4ce267cd7..6ad9370e9 100644 --- a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java @@ -2022,7 +2022,7 @@ public class CollectionUtilsTest extends MockTestCase { @Test public void testSize_Array() { - final Object[] objectArray = new Object[0]; + final Object[] objectArray = {}; assertEquals(0, CollectionUtils.size(objectArray)); final String[] stringArray = new String[3]; @@ -2083,7 +2083,7 @@ public class CollectionUtilsTest extends MockTestCase { @Test public void testSize_PrimitiveArray() { - final int[] intArray = new int[0]; + final int[] intArray = {}; assertEquals(0, CollectionUtils.size(intArray)); final double[] doubleArray = new double[3]; @@ -2096,7 +2096,7 @@ public class CollectionUtilsTest extends MockTestCase { @Test public void testSizeIsEmpty_Array() { - final Object[] objectArray = new Object[0]; + final Object[] objectArray = {}; assertTrue(CollectionUtils.sizeIsEmpty(objectArray)); final String[] stringArray = new String[3]; @@ -2162,7 +2162,7 @@ public class CollectionUtilsTest extends MockTestCase { @Test public void testSizeIsEmpty_PrimitiveArray() { - final int[] intArray = new int[0]; + final int[] intArray = {}; assertTrue(CollectionUtils.sizeIsEmpty(intArray)); final double[] doubleArray = new double[3]; diff --git a/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java b/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java index 0e4c85a46..45150fab4 100644 --- a/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java @@ -240,7 +240,7 @@ public class FactoryUtilsTest { */ @Test public void testSingletonPatternInSerialization() { - final Object[] singletons = new Object[] { + final Object[] singletons = { ExceptionFactory.INSTANCE, }; diff --git a/src/test/java/org/apache/commons/collections4/PredicateUtilsTest.java b/src/test/java/org/apache/commons/collections4/PredicateUtilsTest.java index bd30e5605..3d7387f89 100644 --- a/src/test/java/org/apache/commons/collections4/PredicateUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/PredicateUtilsTest.java @@ -672,7 +672,7 @@ public class PredicateUtilsTest extends AbstractPredicateTest { */ @Test public void testSingletonPatternInSerialization() { - final Object[] singletons = new Object[] { + final Object[] singletons = { ExceptionPredicate.INSTANCE, FalsePredicate.INSTANCE, NotNullPredicate.INSTANCE, diff --git a/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java b/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java index 3bac7fd45..6613543f4 100644 --- a/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java @@ -419,7 +419,7 @@ public class TransformerUtilsTest { */ @Test public void testSingletonPatternInSerialization() { - final Object[] singletons = new Object[] { + final Object[] singletons = { ExceptionTransformer.INSTANCE, NOPTransformer.INSTANCE, StringValueTransformer.stringValueTransformer(), 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 ae325fbe9..d5faf8690 100644 --- a/src/test/java/org/apache/commons/collections4/bag/TransformedBagTest.java +++ b/src/test/java/org/apache/commons/collections4/bag/TransformedBagTest.java @@ -53,7 +53,7 @@ public class TransformedBagTest extends AbstractBagTest { final Bag bag = TransformedBag.transformingBag(new HashBag(), (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); assertTrue(bag.isEmpty()); - final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; + final Object[] els = {"1", "3", "5", "7", "2", "4", "6"}; for (int i = 0; i < els.length; i++) { bag.add((T) els[i]); assertEquals(i + 1, bag.size()); @@ -68,7 +68,7 @@ public class TransformedBagTest extends AbstractBagTest { @SuppressWarnings("unchecked") public void testTransformedBag_decorateTransform() { final Bag originalBag = new HashBag<>(); - final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; + final Object[] els = {"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/bag/TransformedSortedBagTest.java b/src/test/java/org/apache/commons/collections4/bag/TransformedSortedBagTest.java index e175cee4b..e1f076965 100644 --- a/src/test/java/org/apache/commons/collections4/bag/TransformedSortedBagTest.java +++ b/src/test/java/org/apache/commons/collections4/bag/TransformedSortedBagTest.java @@ -50,7 +50,7 @@ public class TransformedSortedBagTest extends AbstractSortedBagTest { public void testTransformedBag() { final SortedBag bag = TransformedSortedBag.transformingSortedBag(new TreeBag(), (Transformer) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, bag.size()); - final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; + final Object[] els = {"1", "3", "5", "7", "2", "4", "6"}; for (int i = 0; i < els.length; i++) { bag.add((T) els[i]); assertEquals(i + 1, bag.size()); @@ -63,7 +63,7 @@ public class TransformedSortedBagTest extends AbstractSortedBagTest { public void testTransformedBag_decorateTransform() { final TreeBag originalBag = new TreeBag<>(); - final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; + final Object[] els = {"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/bidimap/AbstractBidiMapTest.java b/src/test/java/org/apache/commons/collections4/bidimap/AbstractBidiMapTest.java index 8a01b65b7..6ec599b89 100644 --- a/src/test/java/org/apache/commons/collections4/bidimap/AbstractBidiMapTest.java +++ b/src/test/java/org/apache/commons/collections4/bidimap/AbstractBidiMapTest.java @@ -278,7 +278,7 @@ public abstract class AbstractBidiMapTest extends AbstractIterableMapTest< } private void removeByKeySet(final BidiMap map, final Object key, final Object value) { - map.keySet().remove(key); + map.remove(key); assertFalse("Key was not removed.", map.containsKey(key)); assertFalse("Value was not removed.", map.containsValue(value)); diff --git a/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java b/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java index 50983309f..60d63700c 100644 --- a/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java +++ b/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java @@ -1093,7 +1093,7 @@ public abstract class AbstractCollectionTest extends AbstractObjectTest { */ public void testCollectionToArray2() { resetEmpty(); - Object[] a = new Object[] { new Object(), null, null }; + Object[] a = { new Object(), null, null }; Object[] array = getCollection().toArray(a); assertEquals("Given array shouldn't shrink", array, a); assertNull("Last element should be set to null", a[0]); diff --git a/src/test/java/org/apache/commons/collections4/comparators/FixedOrderComparatorTest.java b/src/test/java/org/apache/commons/collections4/comparators/FixedOrderComparatorTest.java index 06fc35287..837bf2e44 100644 --- a/src/test/java/org/apache/commons/collections4/comparators/FixedOrderComparatorTest.java +++ b/src/test/java/org/apache/commons/collections4/comparators/FixedOrderComparatorTest.java @@ -34,7 +34,7 @@ public class FixedOrderComparatorTest extends AbstractComparatorTest { /** * Top cities of the world, by population including metro areas. */ - private static final String topCities[] = new String[] { + private static final String topCities[] = { "Tokyo", "Mexico City", "Mumbai", 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 afda1fc07..e29a52ba9 100644 --- a/src/test/java/org/apache/commons/collections4/functors/ComparatorPredicateTest.java +++ b/src/test/java/org/apache/commons/collections4/functors/ComparatorPredicateTest.java @@ -25,7 +25,7 @@ import org.junit.Test; public class ComparatorPredicateTest extends AbstractPredicateTest { - private class TestComparator> implements Comparator { + private static class TestComparator> implements Comparator { @Override public int compare(final T first, final T second) { return first.compareTo(second); diff --git a/src/test/java/org/apache/commons/collections4/iterators/ArrayListIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/ArrayListIteratorTest.java index 5ba352bd9..f045fb50f 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/ArrayListIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/ArrayListIteratorTest.java @@ -87,9 +87,9 @@ public class ArrayListIteratorTest extends ArrayIteratorTest { */ @SuppressWarnings("unchecked") public void testListIteratorSet() { - final String[] testData = new String[] { "a", "b", "c" }; + final String[] testData = { "a", "b", "c" }; - final String[] result = new String[] { "0", "1", "2" }; + final String[] result = { "0", "1", "2" }; ListIterator iter = makeArrayListIterator(testData); int x = 0; diff --git a/src/test/java/org/apache/commons/collections4/iterators/ObjectArrayListIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/ObjectArrayListIteratorTest.java index 2875db057..1d6ed7e14 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/ObjectArrayListIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/ObjectArrayListIteratorTest.java @@ -84,9 +84,9 @@ public class ObjectArrayListIteratorTest extends ObjectArrayIteratorTest { */ @SuppressWarnings("unchecked") public void testListIteratorSet() { - final String[] testData = new String[] { "a", "b", "c" }; + final String[] testData = { "a", "b", "c" }; - final String[] result = new String[] { "0", "1", "2" }; + final String[] result = { "0", "1", "2" }; ListIterator iter = makeArrayListIterator((E[]) testData); int x = 0; diff --git a/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java b/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java index 05db8fc78..83b07b28b 100644 --- a/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java +++ b/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java @@ -120,7 +120,7 @@ public class MultiKeyTest { @Test public void testConstructorsByArray() throws Exception { MultiKey mk; - Integer[] keys = new Integer[] { THREE, FOUR, ONE, TWO }; + Integer[] keys = { THREE, FOUR, ONE, TWO }; mk = new MultiKey<>(keys); assertArrayEquals(new Object[]{THREE, FOUR, ONE, TWO}, mk.getKeys()); keys[3] = FIVE; // no effect @@ -246,7 +246,7 @@ public class MultiKeyTest { @Test public void testGetKeysArrayConstructorCloned() { - final Integer[] keys = new Integer[] { ONE, TWO }; + final Integer[] keys = { ONE, TWO }; final MultiKey mk = new MultiKey<>(keys, true); final Object[] array = mk.getKeys(); assertNotSame(array, keys); @@ -258,7 +258,7 @@ public class MultiKeyTest { @Test public void testGetKeysArrayConstructorNonCloned() { - final Integer[] keys = new Integer[] { ONE, TWO }; + final Integer[] keys = { ONE, TWO }; final MultiKey mk = new MultiKey<>(keys, false); final Object[] array = mk.getKeys(); assertNotSame(array, keys); // still not equal diff --git a/src/test/java/org/apache/commons/collections4/list/CursorableLinkedListTest.java b/src/test/java/org/apache/commons/collections4/list/CursorableLinkedListTest.java index f9a17ee48..f5396cfc8 100644 --- a/src/test/java/org/apache/commons/collections4/list/CursorableLinkedListTest.java +++ b/src/test/java/org/apache/commons/collections4/list/CursorableLinkedListTest.java @@ -1496,7 +1496,7 @@ public class CursorableLinkedListTest extends AbstractLinkedListTest { final ArrayList list = new ArrayList<>(); final String prefix = "CursorableLinkedListTest"; final String bulk = ".bulkTestSubList"; - final String[] ignored = new String[] { + final String[] ignored = { ".testEmptyListSerialization", ".testFullListSerialization", ".testEmptyListCompatibility", 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 b9bd9c889..87de37080 100644 --- a/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java +++ b/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java @@ -61,18 +61,18 @@ public class SetUniqueListTest extends AbstractListTest { Integer.valueOf(2), "Three", Integer.valueOf(4), - new Double(5), - new Float(6), + Double.valueOf(5), + Float.valueOf(6), "Seven", "Eight", "Nine", Integer.valueOf(10), - new Short((short) 11), - new Long(12), + Short.valueOf((short) 11), + Long.valueOf(12), "Thirteen", "14", "15", - new Byte((byte) 16) + Byte.valueOf((byte) 16) }; } @@ -234,7 +234,7 @@ public class SetUniqueListTest extends AbstractListTest { } public void testFactory() { - final Integer[] array = new Integer[] { Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(1) }; + final Integer[] array = { Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(1) }; final ArrayList list = new ArrayList<>(Arrays.asList(array)); final SetUniqueList lset = SetUniqueList.setUniqueList(list); @@ -337,12 +337,12 @@ public class SetUniqueListTest extends AbstractListTest { // override for set behavior resetFull(); final int size = getCollection().size(); - getCollection().set(0, (E) new Long(1000)); + getCollection().set(0, (E) Long.valueOf(1000)); assertEquals(size, getCollection().size()); - getCollection().set(2, (E) new Long(1000)); + getCollection().set(2, (E) Long.valueOf(1000)); assertEquals(size - 1, getCollection().size()); - assertEquals(new Long(1000), getCollection().get(1)); // set into 2, but shifted down to 1 + assertEquals(Long.valueOf(1000), getCollection().get(1)); // set into 2, but shifted down to 1 } @SuppressWarnings("unchecked") @@ -596,12 +596,12 @@ public class SetUniqueListTest extends AbstractListTest { if (extraVerify) { final int size = getCollection().size(); - getCollection().add((E) new Long(1000)); + getCollection().add((E) Long.valueOf(1000)); assertEquals(size + 1, getCollection().size()); - getCollection().add((E) new Long(1000)); + getCollection().add((E) Long.valueOf(1000)); assertEquals(size + 1, getCollection().size()); - assertEquals(new Long(1000), getCollection().get(size)); + assertEquals(Long.valueOf(1000), getCollection().get(size)); getCollection().remove(size); } 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 92da3d80a..cef6b5751 100644 --- a/src/test/java/org/apache/commons/collections4/list/TransformedListTest.java +++ b/src/test/java/org/apache/commons/collections4/list/TransformedListTest.java @@ -109,7 +109,7 @@ public class TransformedListTest extends AbstractListTest { public void testTransformedList_decorateTransform() { final List originalList = new ArrayList<>(); - final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; + final Object[] els = {"1", "3", "5", "7", "2", "4", "6"}; for (final Object el : els) { originalList.add(el); } 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 69af4e7cd..e30fef439 100644 --- a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java @@ -299,7 +299,7 @@ public abstract class AbstractMapTest extends AbstractObjectTest { */ @SuppressWarnings("unchecked") public K[] getSampleKeys() { - final Object[] result = new Object[] { + final Object[] result = { "blah", "foo", "bar", "baz", "tmp", "gosh", "golly", "gee", "hello", "goodbye", "we'll", "see", "you", "all", "again", "key", @@ -354,7 +354,7 @@ public abstract class AbstractMapTest extends AbstractObjectTest { */ @SuppressWarnings("unchecked") public V[] getSampleValues() { - final Object[] result = new Object[] { + final Object[] result = { "blahv", "foov", "barv", "bazv", "tmpv", "goshv", "gollyv", "geev", "hellov", "goodbyev", "we'llv", "seev", "youv", "allv", "againv", isAllowNullValue() && !JDK12 ? null : "nonnullvalue", @@ -377,7 +377,7 @@ public abstract class AbstractMapTest extends AbstractObjectTest { */ @SuppressWarnings("unchecked") public V[] getNewSampleValues() { - final Object[] result = new Object[] { + final Object[] result = { isAllowNullValue() && !JDK12 && isAllowDuplicateValues() ? null : "newnonnullvalue", "newvalue", isAllowDuplicateValues() ? "newvalue" : "newvalue2", 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 9e95343e7..9bccbf78d 100644 --- a/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java @@ -39,7 +39,7 @@ import org.junit.Test; @SuppressWarnings("boxing") public class LazySortedMapTest extends AbstractSortedMapTest { - private class ReverseStringComparator implements Comparator { + private static class ReverseStringComparator implements Comparator { @Override public int compare(final String arg0, final String arg1) { return arg1.compareTo(arg0); 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 9251662a5..4876405c4 100644 --- a/src/test/java/org/apache/commons/collections4/map/MultiKeyMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/MultiKeyMapTest.java @@ -121,8 +121,8 @@ public class MultiKeyMapTest extends AbstractIterableMapTest extends AbstractMapTest { public void testKeySet() { final Map m = makeTestMap(); - assertEquals(3, m.keySet().size()); + assertEquals(3, m.size()); } public void testPut() { @@ -234,7 +234,7 @@ public class PassiveExpiringMapTest extends AbstractMapTest { public void testValues() { final Map m = makeTestMap(); - assertEquals(3, m.values().size()); + assertEquals(3, m.size()); } public void testZeroTimeToLive() { diff --git a/src/test/java/org/apache/commons/collections4/map/ReferenceMapTest.java b/src/test/java/org/apache/commons/collections4/map/ReferenceMapTest.java index bfaf957e7..064516eb5 100644 --- a/src/test/java/org/apache/commons/collections4/map/ReferenceMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ReferenceMapTest.java @@ -88,8 +88,8 @@ public class ReferenceMapTest extends AbstractIterableMapTest { assertFalse(map.containsValue(null)); assertNull(map.remove(null)); assertFalse(map.entrySet().contains(null)); - assertFalse(map.keySet().contains(null)); - assertFalse(map.values().contains(null)); + assertFalse(map.containsKey(null)); + assertFalse(map.containsValue(null)); try { map.put(null, null); fail(); 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 d8f216006..ffb282898 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 class TransformedMapTest extends AbstractIterableMapTest { @SuppressWarnings({ "unchecked", "rawtypes" }) public void testTransformedMap() { - final Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" }; + final Object[] els = { "1", "3", "5", "7", "2", "4", "6" }; Map map = TransformedMap .transformingMap( 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 a2ea6f925..e5979ac3b 100644 --- a/src/test/java/org/apache/commons/collections4/map/TransformedSortedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/TransformedSortedMapTest.java @@ -65,7 +65,7 @@ public class TransformedSortedMapTest extends AbstractSortedMapTest @SuppressWarnings("unchecked") public void testTransformedMap() { - final Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" }; + final Object[] els = { "1", "3", "5", "7", "2", "4", "6" }; SortedMap map = TransformedSortedMap .transformingSortedMap( 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 7307b4205..f40776b26 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java @@ -129,7 +129,7 @@ public abstract class AbstractMultiValuedMapTest extends AbstractObjectTes */ @SuppressWarnings("unchecked") public K[] getSampleKeys() { - final Object[] result = new Object[] { + final Object[] result = { "one", "one", "two", "two", "three", "three" }; @@ -144,7 +144,7 @@ public abstract class AbstractMultiValuedMapTest extends AbstractObjectTes */ @SuppressWarnings("unchecked") public V[] getSampleValues() { - final Object[] result = new Object[] { + final Object[] result = { "uno", "un", "dos", "deux", "tres", "trois" }; 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 e47bd2e33..7c7d9cd85 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java @@ -51,7 +51,7 @@ public class TransformedMultiValuedMapTest extends AbstractMultiValuedMapT // ----------------------------------------------------------------------- @SuppressWarnings("unchecked") public void testKeyTransformedMap() { - final Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" }; + final Object[] els = { "1", "3", "5", "7", "2", "4", "6" }; final MultiValuedMap map = TransformedMultiValuedMap.transformingMap( new ArrayListValuedHashMap(), @@ -75,7 +75,7 @@ public class TransformedMultiValuedMapTest extends AbstractMultiValuedMapT @SuppressWarnings("unchecked") public void testValueTransformedMap() { - final Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" }; + final Object[] els = { "1", "3", "5", "7", "2", "4", "6" }; final MultiValuedMap map = TransformedMultiValuedMap.transformingMap( new ArrayListValuedHashMap(), null, diff --git a/src/test/java/org/apache/commons/collections4/properties/EmptyPropertiesTest.java b/src/test/java/org/apache/commons/collections4/properties/EmptyPropertiesTest.java index e49b192b7..572cdcdc5 100644 --- a/src/test/java/org/apache/commons/collections4/properties/EmptyPropertiesTest.java +++ b/src/test/java/org/apache/commons/collections4/properties/EmptyPropertiesTest.java @@ -150,7 +150,7 @@ public class EmptyPropertiesTest { @Test public void testKeySet() { - assertTrue(PropertiesFactory.EMPTY_PROPERTIES.keySet().isEmpty()); + assertTrue(PropertiesFactory.EMPTY_PROPERTIES.isEmpty()); } @Test @@ -360,6 +360,6 @@ public class EmptyPropertiesTest { @Test public void testValues() { - assertTrue(PropertiesFactory.EMPTY_PROPERTIES.values().isEmpty()); + assertTrue(PropertiesFactory.EMPTY_PROPERTIES.isEmpty()); } } 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 cd3a9e996..1e71a4f98 100644 --- a/src/test/java/org/apache/commons/collections4/queue/TransformedQueueTest.java +++ b/src/test/java/org/apache/commons/collections4/queue/TransformedQueueTest.java @@ -65,7 +65,7 @@ public class TransformedQueueTest extends AbstractQueueTest { final Queue queue = TransformedQueue.transformingQueue(new LinkedList<>(), TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, queue.size()); - final Object[] elements = new Object[] { "1", "3", "5", "7", "2", "4", "6" }; + final Object[] elements = { "1", "3", "5", "7", "2", "4", "6" }; for (int i = 0; i < elements.length; i++) { queue.add(elements[i]); assertEquals(i + 1, queue.size()); @@ -81,7 +81,7 @@ public class TransformedQueueTest extends AbstractQueueTest { @SuppressWarnings({ "rawtypes", "unchecked" }) public void testTransformedQueue_decorateTransform() { final Queue originalQueue = new LinkedList(); - final Object[] elements = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; + final Object[] elements = {"1", "3", "5", "7", "2", "4", "6"}; Collections.addAll(originalQueue, elements); final Queue queue = TransformedQueue.transformedQueue(originalQueue, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); 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 4ed0737db..66d67cffe 100644 --- a/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java +++ b/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java @@ -57,7 +57,7 @@ public class SequencesComparatorTest { @Test public void testMinimal() { - final String[] shadokAlph = new String[] { + final String[] shadokAlph = { "GA", "BU", "ZO", @@ -109,7 +109,7 @@ public class SequencesComparatorTest { @Test public void testShadok() { final int lgMax = 5; - final String[] shadokAlph = new String[] { + final String[] shadokAlph = { "GA", "BU", "ZO", @@ -154,7 +154,7 @@ public class SequencesComparatorTest { return list; } - private class ExecutionVisitor implements CommandVisitor { + private static class ExecutionVisitor implements CommandVisitor { private List v; private int index; 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 457069a82..12fe70929 100644 --- a/src/test/java/org/apache/commons/collections4/set/TransformedNavigableSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/TransformedNavigableSetTest.java @@ -76,7 +76,7 @@ public class TransformedNavigableSetTest extends AbstractNavigableSetTest public void testTransformedSet_decorateTransform() { final Set originalSet = new TreeSet<>(); - final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; + final Object[] els = {"1", "3", "5", "7", "2", "4", "6"}; Collections.addAll(originalSet, els); final Set set = TransformedSet.transformedSet(originalSet, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); 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 9c71c0222..e309d1ddd 100644 --- a/src/test/java/org/apache/commons/collections4/set/TransformedSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/TransformedSetTest.java @@ -81,7 +81,7 @@ public class TransformedSetTest extends AbstractSetTest { public void testTransformedSet_decorateTransform() { final Set originalSet = new HashSet<>(); - final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; + final Object[] els = {"1", "3", "5", "7", "2", "4", "6"}; Collections.addAll(originalSet, els); final Set set = TransformedSet.transformedSet(originalSet, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); assertEquals(els.length, set.size()); 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 d22239705..f04f484df 100644 --- a/src/test/java/org/apache/commons/collections4/set/TransformedSortedSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/TransformedSortedSetTest.java @@ -74,7 +74,7 @@ public class TransformedSortedSetTest extends AbstractSortedSetTest { public void testTransformedSet_decorateTransform() { final Set originalSet = new TreeSet<>(); - final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; + final Object[] els = {"1", "3", "5", "7", "2", "4", "6"}; Collections.addAll(originalSet, els); final Set set = TransformedSet.transformedSet(originalSet, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); assertEquals(els.length, set.size()); 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 8c2c120cd..37f016677 100644 --- a/src/test/java/org/apache/commons/collections4/splitmap/TransformedSplitMapTest.java +++ b/src/test/java/org/apache/commons/collections4/splitmap/TransformedSplitMapTest.java @@ -50,8 +50,8 @@ public class TransformedSplitMapTest extends BulkTest { final TransformedSplitMap> map = TransformedSplitMap.transformingMap( new HashMap>(), intToString, objectToClass); - final Integer[] k = new Integer[] { 0, 1, 2, 3, 4, 5, 6 }; - final Object[] v = new Object[] { "", new Object(), new HashMap<>(), 0, BigInteger.TEN, null, + final Integer[] k = { 0, 1, 2, 3, 4, 5, 6 }; + final Object[] v = { "", new Object(), new HashMap<>(), 0, BigInteger.TEN, null, new Object[0] }; assertEquals(0, map.size()); 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 7fb131db4..0596d6cef 100755 --- a/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java +++ b/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java @@ -61,7 +61,7 @@ public class PatriciaTrieTest extends AbstractSortedMapTest { public void testPrefixMap() { final PatriciaTrie trie = new PatriciaTrie<>(); - final String[] keys = new String[]{ + final String[] keys = { "", "Albert", "Xavier", "XyZ", "Anna", "Alien", "Alberto", "Alberts", "Allie", "Alliese", "Alabama", "Banane", @@ -289,7 +289,7 @@ public class PatriciaTrieTest extends AbstractSortedMapTest { public void testPrefixMapRemoval() { final PatriciaTrie trie = new PatriciaTrie<>(); - final String[] keys = new String[]{ + final String[] keys = { "Albert", "Xavier", "XyZ", "Anna", "Alien", "Alberto", "Alberts", "Allie", "Alliese", "Alabama", "Banane", "Blabla", "Amber", "Ammun", "Akka", "Akko", "Albertoo", @@ -338,15 +338,15 @@ public class PatriciaTrieTest extends AbstractSortedMapTest { assertEquals("测试", aTree.prefixMap("点").get("点评")); assertFalse(aTree.prefixMap("点").isEmpty()); assertEquals(1, aTree.prefixMap("点").size()); - assertEquals(1, aTree.prefixMap("点").keySet().size()); + assertEquals(1, aTree.prefixMap("点").size()); assertEquals(1, aTree.prefixMap("点").entrySet().size()); - assertEquals(1, aTree.prefixMap("点评").values().size()); + assertEquals(1, aTree.prefixMap("点评").size()); aTree.clear(); aTree.put("点评", "联盟"); aTree.put("点版", "定向"); - assertEquals(2, aTree.prefixMap("点").keySet().size()); - assertEquals(2, aTree.prefixMap("点").values().size()); + assertEquals(2, aTree.prefixMap("点").size()); + assertEquals(2, aTree.prefixMap("点").size()); } public void testPrefixMapSizes2() { @@ -384,8 +384,8 @@ public class PatriciaTrieTest extends AbstractSortedMapTest { prefixMap.clear(); assertTrue(prefixMap.isEmpty()); - assertTrue(prefixMap.keySet().isEmpty()); - assertTrue(prefixMap.values().isEmpty()); + assertTrue(prefixMap.isEmpty()); + assertTrue(prefixMap.isEmpty()); assertEquals(new HashSet<>(Arrays.asList("Anael", "Analu", "Anatole", "Anna")), trie.keySet()); assertEquals(Arrays.asList(2, 3, 7, 1), new ArrayList<>(trie.values())); } @@ -398,8 +398,8 @@ public class PatriciaTrieTest extends AbstractSortedMapTest { prefixMap.clear(); assertTrue(prefixMap.isEmpty()); - assertTrue(prefixMap.keySet().isEmpty()); - assertTrue(prefixMap.values().isEmpty()); + assertTrue(prefixMap.isEmpty()); + assertTrue(prefixMap.isEmpty()); assertEquals(new HashSet(), trie.keySet()); assertEquals(new ArrayList(0), new ArrayList<>(trie.values())); } @@ -421,8 +421,8 @@ public class PatriciaTrieTest extends AbstractSortedMapTest { for (final String key : keys) { prefixMap.remove(key); } - assertTrue(prefixMap.keySet().isEmpty()); - assertTrue(prefixMap.values().isEmpty()); + assertTrue(prefixMap.isEmpty()); + assertTrue(prefixMap.isEmpty()); assertEquals(new HashSet<>(Arrays.asList("Anael", "Analu", "Anatole", "Anna")), trie.keySet()); assertEquals(Arrays.asList(2, 3, 7, 1), new ArrayList<>(trie.values())); }