You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2019/12/18 20:55:29 UTC

[commons-collections] branch master updated (c770147 -> 8308cff)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git.


    from c770147  Fix links to release notes and update contents for 4.4 #127.
     new 45763ba  Remove trailing white spaces on all lines.
     new 8308cff  Remove unnecessary array creation for varargs.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/main/java/org/apache/commons/collections4/IteratorUtils.java  | 2 +-
 src/main/java/org/apache/commons/collections4/SetUtils.java       | 2 +-
 .../apache/commons/collections4/functors/PrototypeFactory.java    | 2 +-
 src/test/java/org/apache/commons/collections4/BulkTest.java       | 2 +-
 .../java/org/apache/commons/collections4/ClosureUtilsTest.java    | 6 +++---
 .../java/org/apache/commons/collections4/CollectionUtilsTest.java | 2 +-
 .../org/apache/commons/collections4/TransformerUtilsTest.java     | 6 +++---
 .../collections4/collection/TransformedCollectionTest.java        | 2 +-
 .../org/apache/commons/collections4/map/DefaultedMapTest.java     | 4 ++--
 .../org/apache/commons/collections4/map/LazySortedMapTest.java    | 6 +++---
 .../apache/commons/collections4/map/PredicatedSortedMapTest.java  | 8 ++++----
 .../commons/collections4/multimap/ArrayListValuedHashMapTest.java | 2 +-
 .../apache/commons/collections4/queue/CircularFifoQueueTest.java  | 2 +-
 .../apache/commons/collections4/queue/UnmodifiableQueueTest.java  | 2 +-
 14 files changed, 24 insertions(+), 24 deletions(-)


[commons-collections] 02/02: Remove unnecessary array creation for varargs.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 8308cff798f36d82bb1f8d5fb8718d47a466708a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Dec 18 15:55:25 2019 -0500

    Remove unnecessary array creation for varargs.
---
 .../org/apache/commons/collections4/functors/PrototypeFactory.java  | 2 +-
 src/test/java/org/apache/commons/collections4/BulkTest.java         | 2 +-
 src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java | 6 +++---
 .../java/org/apache/commons/collections4/CollectionUtilsTest.java   | 2 +-
 .../java/org/apache/commons/collections4/TransformerUtilsTest.java  | 6 +++---
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/commons/collections4/functors/PrototypeFactory.java b/src/main/java/org/apache/commons/collections4/functors/PrototypeFactory.java
index 20045af..4c19f2a 100644
--- a/src/main/java/org/apache/commons/collections4/functors/PrototypeFactory.java
+++ b/src/main/java/org/apache/commons/collections4/functors/PrototypeFactory.java
@@ -73,7 +73,7 @@ public class PrototypeFactory {
 
         } catch (final NoSuchMethodException ex) {
             try {
-                prototype.getClass().getConstructor(new Class<?>[] { prototype.getClass() });
+                prototype.getClass().getConstructor(prototype.getClass());
                 return new InstantiateFactory<>(
                     (Class<T>) prototype.getClass(),
                     new Class<?>[] { prototype.getClass() },
diff --git a/src/test/java/org/apache/commons/collections4/BulkTest.java b/src/test/java/org/apache/commons/collections4/BulkTest.java
index bbe4f62..80e055a 100644
--- a/src/test/java/org/apache/commons/collections4/BulkTest.java
+++ b/src/test/java/org/apache/commons/collections4/BulkTest.java
@@ -416,7 +416,7 @@ class BulkTestSuiteMaker {
 
     private static <T> Constructor<T> getTestCaseConstructor(final Class<T> c) {
         try {
-            return c.getConstructor(new Class[] { String.class });
+            return c.getConstructor(String.class);
         } catch (final NoSuchMethodException e) {
             throw new IllegalArgumentException(c + " must provide a (String) constructor");
         }
diff --git a/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java b/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java
index f4fa7bd..0bfaa43 100644
--- a/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java
@@ -182,7 +182,7 @@ public class ClosureUtilsTest {
 
         a = new MockClosure<>();
         b = new MockClosure<>();
-        ClosureUtils.<Object>chainedClosure(new Closure[] {a, b, a}).execute(null);
+        ClosureUtils.<Object>chainedClosure(a, b, a).execute(null);
         assertEquals(2, a.count);
         assertEquals(1, b.count);
 
@@ -196,7 +196,7 @@ public class ClosureUtilsTest {
         assertEquals(1, a.count);
         assertEquals(2, b.count);
 
-        assertSame(NOPClosure.INSTANCE, ClosureUtils.<Object>chainedClosure(new Closure[0]));
+        assertSame(NOPClosure.INSTANCE, ClosureUtils.<Object>chainedClosure());
         assertSame(NOPClosure.INSTANCE, ClosureUtils.<Object>chainedClosure(Collections.<Closure<Object>>emptyList()));
 
         try {
@@ -212,7 +212,7 @@ public class ClosureUtilsTest {
             fail();
         } catch (final NullPointerException ex) {}
         try {
-            ClosureUtils.<Object>chainedClosure(new Closure[] {null, null});
+            ClosureUtils.<Object>chainedClosure(null, null);
             fail();
         } catch (final NullPointerException ex) {}
         try {
diff --git a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
index 6f4a5b1..fca9f30 100644
--- a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
@@ -1737,7 +1737,7 @@ public class CollectionUtilsTest extends MockTestCase {
 
     @Test
     public void addAllForElements() {
-        CollectionUtils.addAll(collectionA, new Integer[]{5});
+        CollectionUtils.addAll(collectionA, 5);
         assertTrue(collectionA.contains(5));
     }
 
diff --git a/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java b/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java
index b47d10f..50361a2 100644
--- a/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java
@@ -201,13 +201,13 @@ public class TransformerUtilsTest {
 
         assertEquals("A", TransformerUtils.chainedTransformer(b, a).transform(null));
         assertEquals("B", TransformerUtils.chainedTransformer(a, b).transform(null));
-        assertEquals("A", TransformerUtils.chainedTransformer(new Transformer[] { b, a }).transform(null));
+        assertEquals("A", TransformerUtils.chainedTransformer(b, a).transform(null));
         Collection<Transformer<Object, Object>> coll = new ArrayList<>();
         coll.add(b);
         coll.add(a);
         assertEquals("A", TransformerUtils.chainedTransformer(coll).transform(null));
 
-        assertSame(NOPTransformer.INSTANCE, TransformerUtils.chainedTransformer(new Transformer[0]));
+        assertSame(NOPTransformer.INSTANCE, TransformerUtils.chainedTransformer());
         assertSame(NOPTransformer.INSTANCE, TransformerUtils.chainedTransformer(Collections.<Transformer<Object, Object>>emptyList()));
 
         try {
@@ -223,7 +223,7 @@ public class TransformerUtilsTest {
             fail();
         } catch (final NullPointerException ex) {}
         try {
-            TransformerUtils.chainedTransformer(new Transformer[] {null, null});
+            TransformerUtils.chainedTransformer(null, null);
             fail();
         } catch (final NullPointerException ex) {}
         try {


[commons-collections] 01/02: Remove trailing white spaces on all lines.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 45763ba694a6186bb9feada08873892bb35fd662
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Dec 18 15:28:39 2019 -0500

    Remove trailing white spaces on all lines.
---
 src/main/java/org/apache/commons/collections4/IteratorUtils.java  | 2 +-
 src/main/java/org/apache/commons/collections4/SetUtils.java       | 2 +-
 .../collections4/collection/TransformedCollectionTest.java        | 2 +-
 .../org/apache/commons/collections4/map/DefaultedMapTest.java     | 4 ++--
 .../org/apache/commons/collections4/map/LazySortedMapTest.java    | 6 +++---
 .../apache/commons/collections4/map/PredicatedSortedMapTest.java  | 8 ++++----
 .../commons/collections4/multimap/ArrayListValuedHashMapTest.java | 2 +-
 .../apache/commons/collections4/queue/CircularFifoQueueTest.java  | 2 +-
 .../apache/commons/collections4/queue/UnmodifiableQueueTest.java  | 2 +-
 9 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/main/java/org/apache/commons/collections4/IteratorUtils.java b/src/main/java/org/apache/commons/collections4/IteratorUtils.java
index 29296a9..bf389be 100644
--- a/src/main/java/org/apache/commons/collections4/IteratorUtils.java
+++ b/src/main/java/org/apache/commons/collections4/IteratorUtils.java
@@ -1190,7 +1190,7 @@ public class IteratorUtils {
      */
     public static <E> E forEachButLast(final Iterator<E> iterator, final Closure<? super E> closure) {
         Objects.requireNonNull(closure, "closure");
-        
+
         if (iterator != null) {
             while (iterator.hasNext()) {
                 final E element = iterator.next();
diff --git a/src/main/java/org/apache/commons/collections4/SetUtils.java b/src/main/java/org/apache/commons/collections4/SetUtils.java
index 658af05..97e46e5 100644
--- a/src/main/java/org/apache/commons/collections4/SetUtils.java
+++ b/src/main/java/org/apache/commons/collections4/SetUtils.java
@@ -159,7 +159,7 @@ public class SetUtils {
     public static <E> SetView<E> disjunction(final Set<? extends E> setA, final Set<? extends E> setB) {
         Objects.requireNonNull(setA, "setA");
         Objects.requireNonNull(setB, "setB");
-        
+
         final SetView<E> aMinusB = difference(setA, setB);
         final SetView<E> bMinusA = difference(setB, setA);
 
diff --git a/src/test/java/org/apache/commons/collections4/collection/TransformedCollectionTest.java b/src/test/java/org/apache/commons/collections4/collection/TransformedCollectionTest.java
index 172d6f8..cd81550 100644
--- a/src/test/java/org/apache/commons/collections4/collection/TransformedCollectionTest.java
+++ b/src/test/java/org/apache/commons/collections4/collection/TransformedCollectionTest.java
@@ -39,7 +39,7 @@ public class TransformedCollectionTest extends AbstractCollectionTest<Object> {
             return Integer.valueOf((String) input);
         }
     }
-    
+
     private static class ToLowerCase implements Transformer<Object, Object> {
         @Override
         public Object transform(final Object input) {
diff --git a/src/test/java/org/apache/commons/collections4/map/DefaultedMapTest.java b/src/test/java/org/apache/commons/collections4/map/DefaultedMapTest.java
index 5c0da38..f047f2d 100644
--- a/src/test/java/org/apache/commons/collections4/map/DefaultedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/DefaultedMapTest.java
@@ -138,7 +138,7 @@ public class DefaultedMapTest<K, V> extends AbstractIterableMapTest<K, V> {
          } catch (NullPointerException e) {
              // Expected
          }
-    
+
          try {
              DefaultedMap.defaultedMap((Map<K, V>) null, nullFactory);
              fail("Expecting NullPointerException");
@@ -152,7 +152,7 @@ public class DefaultedMapTest<K, V> extends AbstractIterableMapTest<K, V> {
          } catch (NullPointerException e) {
              // Expected
          }
-    
+
          try {
              DefaultedMap.defaultedMap((Map<K, V>) null, nullTransformer);
              fail("Expecting NullPointerException");
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 4a67ec8..8b0d275 100644
--- a/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java
@@ -45,9 +45,9 @@ public class LazySortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
 			return arg1.compareTo(arg0);
 		}
 	}
-	
+
     private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1);
-    
+
     protected final Comparator<String> reverseStringComparator = new ReverseStringComparator();
 
     public LazySortedMapTest(final String testName) {
@@ -105,7 +105,7 @@ public class LazySortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
         assertTrue("natural order, so comparator should be null",
             c == null);
     }
-    
+
     public void testReverseSortOrder() {
         final SortedMap<String, Number> map = lazySortedMap(new ConcurrentSkipListMap<String, Number>(reverseStringComparator), oneFactory);
         map.put("A",  5);
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 dd059ab..730b27a 100644
--- a/src/test/java/org/apache/commons/collections4/map/PredicatedSortedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/PredicatedSortedMapTest.java
@@ -41,11 +41,11 @@ public class PredicatedSortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
 			return ((String) arg1).compareTo((String)arg0);
 		}
 	}
-	
+
     protected static final Predicate<Object> truePredicate = TruePredicate.truePredicate();
 
     protected static final Predicate<Object> testPredicate = o -> o instanceof String;
-    
+
     protected final Comparator<K> reverseStringComparator = new ReverseStringComparator();
 
     public PredicatedSortedMapTest(final String testName) {
@@ -66,7 +66,7 @@ public class PredicatedSortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
     public SortedMap<K, V> makeTestMap() {
         return decorateMap(new TreeMap<K, V>(), testPredicate, testPredicate);
     }
-    
+
     public SortedMap<K, V> makeTestMapWithComparator() {
         return decorateMap(new ConcurrentSkipListMap<K, V>(reverseStringComparator), testPredicate, testPredicate);
     }
@@ -178,7 +178,7 @@ public class PredicatedSortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
         assertTrue("natural order, so comparator should be null",
             c == null);
     }
-    
+
     @SuppressWarnings("unchecked")
     public void testReverseSortOrder() {
         final SortedMap<K, V> map = makeTestMapWithComparator();
diff --git a/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMapTest.java
index 0cbfbb4..be9ce42 100644
--- a/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMapTest.java
@@ -215,7 +215,7 @@ public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest
         assertEquals(3, listMap.get((K) "A").indexOf("Q"));
         assertEquals(4, listMap.get((K) "A").lastIndexOf("Q"));
         assertEquals(-1, listMap.get((K) "A").lastIndexOf("A"));
-        
+
         List<V> list2 = new ArrayList<>();
         listMap.get((K) "B").addAll(0, list2);
         assertEquals("{A=[W, X, F, Q, Q, L]}", listMap.toString());
diff --git a/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java b/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java
index 79cefea..a8751c9 100644
--- a/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java
+++ b/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java
@@ -466,7 +466,7 @@ public class CircularFifoQueueTest<E> extends AbstractQueueTest<E> {
         }
         fail();
     }
-	
+
 	@Override
     public String getCompatibilityVersion() {
         return "4";
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 fe300d3..d769c29 100644
--- a/src/test/java/org/apache/commons/collections4/queue/UnmodifiableQueueTest.java
+++ b/src/test/java/org/apache/commons/collections4/queue/UnmodifiableQueueTest.java
@@ -105,7 +105,7 @@ public class UnmodifiableQueueTest<E> extends AbstractQueueTest<E> {
             fail();
         } catch (final NullPointerException ex) {}
     }
-	
+
 	public void testOffer() {
         Queue<E> queue = makeFullCollection();
         E e = null;