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 2024/06/23 18:20:54 UTC

(commons-collections) branch master updated (f42bac458 -> f5e0f2c09)

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 f42bac458 Javadoc
     new 3ed0b64c5 Remove unnecessary keyword
     new d51fff2bd Use if-else
     new 9e6fcd3f8 Remove unnecessary keyword
     new daa1814bf Remove unnecessary keyword
     new 422f26fe6 Remove unnecessary keyword
     new c40ad3a39 Remove unnecessary keyword
     new 7e152d493 Use if-else
     new 1835a52a8 Use if-else
     new 6d4ea100f Remove unnecessary keyword
     new de1d2732d Use Collections.sort(List) for clarity
     new f5e0f2c09 Use Collections.sort(List) for clarity

The 11 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:
 .../collections4/map/AbstractHashedMap.java        |  6 ++----
 .../map/AbstractInputCheckedMapDecorator.java      |  6 +++---
 .../collections4/multiset/AbstractMultiSet.java    |  2 +-
 .../collections4/trie/AbstractPatriciaTrie.java    | 22 ++++++++--------------
 .../commons/collections4/CollectionUtilsTest.java  |  4 ++--
 .../commons/collections4/bag/AbstractBagTest.java  |  8 ++++----
 .../collections4/bag/AbstractSortedBagTest.java    |  8 ++++----
 .../bidimap/AbstractSortedBidiMapTest.java         |  2 +-
 .../collections4/list/AbstractListTest.java        |  8 ++++----
 .../collections4/map/AbstractOrderedMapTest.java   |  6 ++----
 .../multiset/AbstractMultiSetTest.java             |  8 ++++----
 11 files changed, 35 insertions(+), 45 deletions(-)


(commons-collections) 02/11: Use if-else

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 d51fff2bddfecca83c5231e50ec30772ddea82c3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:17:17 2024 -0400

    Use if-else
---
 .../java/org/apache/commons/collections4/map/AbstractHashedMap.java | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java b/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java
index 1dc9258ca..8e458ad97 100644
--- a/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java
+++ b/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java
@@ -1030,10 +1030,8 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab
                     if (map.get(key) != null || !map.containsKey(key)) {
                         return false;
                     }
-                } else {
-                    if (!value.equals(map.get(key))) {
-                        return false;
-                    }
+                } else if (!value.equals(map.get(key))) {
+                    return false;
                 }
             }
         } catch (final ClassCastException | NullPointerException ignored) {


(commons-collections) 11/11: Use Collections.sort(List) for clarity

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 f5e0f2c0994c6f25c23e1cb6acdd84dbe23c166b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:20:39 2024 -0400

    Use Collections.sort(List) for clarity
---
 .../java/org/apache/commons/collections4/CollectionUtilsTest.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
index 63fca4022..aaecfa991 100644
--- a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
@@ -596,7 +596,7 @@ public class CollectionUtilsTest extends MockTestCase {
 
         final List<Integer> combinedList = new ArrayList<>(collectionD);
         combinedList.addAll(collectionE);
-        combinedList.sort(null);
+        Collections.sort(combinedList);
 
         assertEquals(combinedList, result2, "Merge two lists 2");
 
@@ -640,7 +640,7 @@ public class CollectionUtilsTest extends MockTestCase {
         final Set<Integer> combinedSet = new HashSet<>(collectionD);
         combinedSet.addAll(collectionE);
         final List<Integer> combinedList = new ArrayList<>(combinedSet);
-        combinedList.sort(null);
+        Collections.sort(combinedList);
 
         assertEquals(combinedList, result2, "Merge two lists 2 - ignore duplicates");
     }


(commons-collections) 09/11: Remove unnecessary keyword

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 6d4ea100ff53310fcb1f5cc6a51078e1fd3afd42
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:19:20 2024 -0400

    Remove unnecessary keyword
---
 .../apache/commons/collections4/bag/AbstractSortedBagTest.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/commons/collections4/bag/AbstractSortedBagTest.java b/src/test/java/org/apache/commons/collections4/bag/AbstractSortedBagTest.java
index c3e27e4a7..eb49dd068 100644
--- a/src/test/java/org/apache/commons/collections4/bag/AbstractSortedBagTest.java
+++ b/src/test/java/org/apache/commons/collections4/bag/AbstractSortedBagTest.java
@@ -105,14 +105,14 @@ public abstract class AbstractSortedBagTest<T> extends AbstractBagTest<T> {
 
     @Override
     public void resetEmpty() {
-        this.setCollection(CollectionSortedBag.collectionSortedBag(makeObject()));
-        this.setConfirmed(makeConfirmedCollection());
+        setCollection(CollectionSortedBag.collectionSortedBag(makeObject()));
+        setConfirmed(makeConfirmedCollection());
     }
 
     @Override
     public void resetFull() {
-        this.setCollection(CollectionSortedBag.collectionSortedBag(makeFullCollection()));
-        this.setConfirmed(makeConfirmedFullCollection());
+        setCollection(CollectionSortedBag.collectionSortedBag(makeFullCollection()));
+        setConfirmed(makeConfirmedFullCollection());
     }
 
     /**


(commons-collections) 04/11: Remove unnecessary keyword

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 daa1814bf340d5e218487aa35545314ca47d9e45
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:17:55 2024 -0400

    Remove unnecessary keyword
---
 .../org/apache/commons/collections4/list/AbstractListTest.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java b/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java
index 960e5276f..32a5a1e87 100644
--- a/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java
+++ b/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java
@@ -110,16 +110,16 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> {
         @Override
         public void resetEmpty() {
             outer.resetFull();
-            this.setCollection(outer.getCollection().subList(4, 4));
-            this.setConfirmed(outer.getConfirmed().subList(4, 4));
+            setCollection(outer.getCollection().subList(4, 4));
+            setConfirmed(outer.getConfirmed().subList(4, 4));
         }
 
         @Override
         public void resetFull() {
             outer.resetFull();
             final int size = outer.getConfirmed().size();
-            this.setCollection(outer.getCollection().subList(3, size - 3));
-            this.setConfirmed(outer.getConfirmed().subList(3, size - 3));
+            setCollection(outer.getCollection().subList(3, size - 3));
+            setConfirmed(outer.getConfirmed().subList(3, size - 3));
         }
 
         @Override


(commons-collections) 06/11: Remove unnecessary keyword

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 c40ad3a39d0a7906e289a257f67dc51ccf48dee5
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:18:39 2024 -0400

    Remove unnecessary keyword
---
 .../commons/collections4/multiset/AbstractMultiSetTest.java       | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java b/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java
index 241b61059..3a366260f 100644
--- a/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java
+++ b/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java
@@ -202,14 +202,14 @@ public abstract class AbstractMultiSetTest<T> extends AbstractCollectionTest<T>
 
     @Override
     public void resetEmpty() {
-        this.setCollection(makeObject());
-        this.setConfirmed(makeConfirmedCollection());
+        setCollection(makeObject());
+        setConfirmed(makeConfirmedCollection());
     }
 
     @Override
     public void resetFull() {
-        this.setCollection(makeFullCollection());
-        this.setConfirmed(makeConfirmedFullCollection());
+        setCollection(makeFullCollection());
+        setConfirmed(makeConfirmedFullCollection());
     }
 
     /**


(commons-collections) 08/11: Use if-else

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 1835a52a8e425eae88554195ac7db9212f57375b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:19:07 2024 -0400

    Use if-else
---
 .../collections4/trie/AbstractPatriciaTrie.java    | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java b/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
index ec50fa7ff..7506c3eac 100644
--- a/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
+++ b/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
@@ -774,12 +774,10 @@ public abstract class AbstractPatriciaTrie<K, V> extends AbstractBitwiseTrie<K,
             Map.Entry<K, V> e = null;
             if (fromKey == null) {
                 e = firstEntry();
+            } else if (fromInclusive) {
+                e = ceilingEntry(fromKey);
             } else {
-                if (fromInclusive) {
-                    e = ceilingEntry(fromKey);
-                } else {
-                    e = higherEntry(fromKey);
-                }
+                e = higherEntry(fromKey);
             }
 
             final K first = e != null ? e.getKey() : null;
@@ -814,12 +812,10 @@ public abstract class AbstractPatriciaTrie<K, V> extends AbstractBitwiseTrie<K,
             final Map.Entry<K, V> e;
             if (toKey == null) {
                 e = lastEntry();
+            } else if (toInclusive) {
+                e = floorEntry(toKey);
             } else {
-                if (toInclusive) {
-                    e = floorEntry(toKey);
-                } else {
-                    e = lowerEntry(toKey);
-                }
+                e = lowerEntry(toKey);
             }
 
             final K last = e != null ? e.getKey() : null;
@@ -2314,10 +2310,8 @@ public abstract class AbstractPatriciaTrie<K, V> extends AbstractBitwiseTrie<K,
             if (selectR(h.left, h.bitIndex, key, lengthInBits, reference)) {
                 return selectR(h.right, h.bitIndex, key, lengthInBits, reference);
             }
-        } else {
-            if (selectR(h.right, h.bitIndex, key, lengthInBits, reference)) {
-                return selectR(h.left, h.bitIndex, key, lengthInBits, reference);
-            }
+        } else if (selectR(h.right, h.bitIndex, key, lengthInBits, reference)) {
+            return selectR(h.left, h.bitIndex, key, lengthInBits, reference);
         }
         return false;
     }


(commons-collections) 03/11: Remove unnecessary keyword

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 9e6fcd3f8ca85ac76df20155d0955270a89db3dd
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:17:35 2024 -0400

    Remove unnecessary keyword
---
 .../commons/collections4/map/AbstractInputCheckedMapDecorator.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractInputCheckedMapDecorator.java b/src/main/java/org/apache/commons/collections4/map/AbstractInputCheckedMapDecorator.java
index 3045a104f..2ab0a0dff 100644
--- a/src/main/java/org/apache/commons/collections4/map/AbstractInputCheckedMapDecorator.java
+++ b/src/main/java/org/apache/commons/collections4/map/AbstractInputCheckedMapDecorator.java
@@ -65,13 +65,13 @@ abstract class AbstractInputCheckedMapDecorator<K, V>
 
         @Override
         public Iterator<Map.Entry<K, V>> iterator() {
-            return new EntrySetIterator(this.decorated().iterator(), parent);
+            return new EntrySetIterator(decorated().iterator(), parent);
         }
 
         @Override
         @SuppressWarnings("unchecked")
         public Object[] toArray() {
-            final Object[] array = this.decorated().toArray();
+            final Object[] array = decorated().toArray();
             for (int i = 0; i < array.length; i++) {
                 array[i] = new MapEntry((Map.Entry<K, V>) array[i], parent);
             }
@@ -87,7 +87,7 @@ abstract class AbstractInputCheckedMapDecorator<K, V>
                 // where another thread could access data before we decorate it
                 result = (Object[]) Array.newInstance(array.getClass().getComponentType(), 0);
             }
-            result = this.decorated().toArray(result);
+            result = decorated().toArray(result);
             for (int i = 0; i < result.length; i++) {
                 result[i] = new MapEntry((Map.Entry<K, V>) result[i], parent);
             }


(commons-collections) 10/11: Use Collections.sort(List) for clarity

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 de1d2732ddc18485ee2632ee968c07860baa1cb4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:20:21 2024 -0400

    Use Collections.sort(List) for clarity
---
 .../apache/commons/collections4/bidimap/AbstractSortedBidiMapTest.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapTest.java b/src/test/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapTest.java
index 325e220e8..61b2fd7f6 100644
--- a/src/test/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapTest.java
@@ -48,7 +48,7 @@ public abstract class AbstractSortedBidiMapTest<K extends Comparable<K>, V exten
     public AbstractSortedBidiMapTest(final String testName) {
         super(testName);
         sortedKeys = getAsList(getSampleKeys());
-        sortedKeys.sort(null);
+        Collections.sort(sortedKeys);
         sortedKeys = Collections.unmodifiableList(sortedKeys);
 
         final Map<K, V> map = new TreeMap<>();


(commons-collections) 07/11: Use if-else

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 7e152d493534617ee7e76ae2b587243102a7be84
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:18:47 2024 -0400

    Use if-else
---
 .../org/apache/commons/collections4/map/AbstractOrderedMapTest.java | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

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 62bc5346c..9caf0c4fc 100644
--- a/src/test/java/org/apache/commons/collections4/map/AbstractOrderedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/AbstractOrderedMapTest.java
@@ -240,10 +240,8 @@ public abstract class AbstractOrderedMapTest<K, V> extends AbstractIterableMapTe
         if (!isAllowNullKey()) {
             final OrderedMap<K, V> finalOrdered = ordered;
             assertThrows(NullPointerException.class, () -> finalOrdered.previousKey(null));
-        } else {
-            if (!isAllowNullKey()) {
-                assertNull(ordered.previousKey(null));
-            }
+        } else if (!isAllowNullKey()) {
+            assertNull(ordered.previousKey(null));
         }
     }
 


(commons-collections) 01/11: Remove unnecessary keyword

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 3ed0b64c5de7a22c6d204c2d5a30f05b7c2b6e70
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:16:24 2024 -0400

    Remove unnecessary keyword
---
 .../java/org/apache/commons/collections4/bag/AbstractBagTest.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java b/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java
index 2dd9fef3c..2b744be13 100644
--- a/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java
+++ b/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java
@@ -209,14 +209,14 @@ public abstract class AbstractBagTest<T> extends AbstractCollectionTest<T> {
 
     @Override
     public void resetEmpty() {
-        this.setCollection(CollectionBag.collectionBag(makeObject()));
-        this.setConfirmed(makeConfirmedCollection());
+        setCollection(CollectionBag.collectionBag(makeObject()));
+        setConfirmed(makeConfirmedCollection());
     }
 
     @Override
     public void resetFull() {
-        this.setCollection(CollectionBag.collectionBag(makeFullCollection()));
-        this.setConfirmed(makeConfirmedFullCollection());
+        setCollection(CollectionBag.collectionBag(makeFullCollection()));
+        setConfirmed(makeConfirmedFullCollection());
     }
 
     @Test


(commons-collections) 05/11: Remove unnecessary keyword

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 422f26fe6ba524a7e18f16d44762af66021d9091
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:18:06 2024 -0400

    Remove unnecessary keyword
---
 .../java/org/apache/commons/collections4/multiset/AbstractMultiSet.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/collections4/multiset/AbstractMultiSet.java b/src/main/java/org/apache/commons/collections4/multiset/AbstractMultiSet.java
index 9d6674882..822da4a64 100644
--- a/src/main/java/org/apache/commons/collections4/multiset/AbstractMultiSet.java
+++ b/src/main/java/org/apache/commons/collections4/multiset/AbstractMultiSet.java
@@ -48,7 +48,7 @@ public abstract class AbstractMultiSet<E> extends AbstractCollection<E> implemen
         public boolean equals(final Object object) {
             if (object instanceof Entry) {
                 final Entry<?> other = (Entry<?>) object;
-                final E element = this.getElement();
+                final E element = getElement();
                 final Object otherElement = other.getElement();
 
                 return this.getCount() == other.getCount() &&