You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2021/03/04 19:43:00 UTC

[commons-collections] branch master updated (7ea143a -> 86733aa)

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

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


    from 7ea143a  Merge branch 'pr-219'
     new 331ee24  [COLLECTIONS-785] Add constant variable
     new bd67f9a  [COLLECTIONS-785] Add changelog
     new 86733aa  Merge branch 'pr-217'

The 3 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/changes/changes.xml                            |  3 +++
 .../commons/collections4/CollectionUtils.java      | 27 ++++++++++++++++++++++
 .../apache/commons/collections4/IteratorUtils.java | 17 +++-----------
 .../commons/collections4/bag/AbstractMapBag.java   |  9 ++++----
 .../collections4/list/AbstractLinkedList.java      |  4 ++--
 .../apache/commons/collections4/list/TreeList.java |  7 +++---
 .../collections4/map/AbstractHashedMap.java        |  3 ++-
 .../apache/commons/collections4/map/Flat3Map.java  |  5 ++--
 8 files changed, 49 insertions(+), 26 deletions(-)


[commons-collections] 01/03: [COLLECTIONS-785] Add constant variable

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

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

commit 331ee240c2674da40afcec2a3c458c9809230c94
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Fri Feb 26 08:11:08 2021 +0100

    [COLLECTIONS-785] Add constant variable
---
 .../commons/collections4/CollectionUtils.java      | 27 ++++++++++++++++++++++
 .../apache/commons/collections4/IteratorUtils.java | 17 +++-----------
 .../commons/collections4/bag/AbstractMapBag.java   |  9 ++++----
 .../collections4/list/AbstractLinkedList.java      |  4 ++--
 .../apache/commons/collections4/list/TreeList.java |  7 +++---
 .../collections4/map/AbstractHashedMap.java        |  3 ++-
 .../apache/commons/collections4/map/Flat3Map.java  |  5 ++--
 7 files changed, 46 insertions(+), 26 deletions(-)

diff --git a/src/main/java/org/apache/commons/collections4/CollectionUtils.java b/src/main/java/org/apache/commons/collections4/CollectionUtils.java
index 2ba465a..b5820aa 100644
--- a/src/main/java/org/apache/commons/collections4/CollectionUtils.java
+++ b/src/main/java/org/apache/commons/collections4/CollectionUtils.java
@@ -64,6 +64,33 @@ public class CollectionUtils {
     public static final int INDEX_NOT_FOUND = -1;
 
     /**
+     * Default prefix used while converting an Iterator to its String representation.
+     *
+     * @since 4.5
+     */
+    public static final String DEFAULT_TOSTRING_PREFIX = "[";
+
+    /**
+     * Default suffix used while converting an Iterator to its String representation.
+     *
+     * @since 4.5
+     */
+    public static final String DEFAULT_TOSTRING_SUFFIX = "]";
+
+    /**
+     * A String for Colon  (":").
+     *
+     * @since 4.5
+     */
+    public static final String COLON = ":";
+    /**
+     * A String for Comma (",").
+     *
+     * @since 4.5
+     */
+    public static final String COMMA = ",";
+
+    /**
      * Helper class to easily access cardinality properties of two collections.
      * @param <O>  the element type
      */
diff --git a/src/main/java/org/apache/commons/collections4/IteratorUtils.java b/src/main/java/org/apache/commons/collections4/IteratorUtils.java
index b2c8704..d11ceef 100644
--- a/src/main/java/org/apache/commons/collections4/IteratorUtils.java
+++ b/src/main/java/org/apache/commons/collections4/IteratorUtils.java
@@ -105,17 +105,6 @@ public class IteratorUtils {
      */
     @SuppressWarnings("rawtypes")
     public static final OrderedMapIterator EMPTY_ORDERED_MAP_ITERATOR = EmptyOrderedMapIterator.INSTANCE;
-
-    /**
-     * Default prefix used while converting an Iterator to its String representation.
-     */
-    private static final String DEFAULT_TOSTRING_PREFIX = "[";
-
-    /**
-     * Default suffix used while converting an Iterator to its String representation.
-     */
-    private static final String DEFAULT_TOSTRING_SUFFIX = "]";
-
     /**
      * Default delimiter used to delimit elements while converting an Iterator
      * to its String representation.
@@ -1405,8 +1394,8 @@ public class IteratorUtils {
      */
     public static <E> String toString(final Iterator<E> iterator) {
         return toString(iterator, TransformerUtils.stringValueTransformer(),
-                        DEFAULT_TOSTRING_DELIMITER, DEFAULT_TOSTRING_PREFIX,
-                        DEFAULT_TOSTRING_SUFFIX);
+                        DEFAULT_TOSTRING_DELIMITER, CollectionUtils.DEFAULT_TOSTRING_PREFIX,
+                CollectionUtils.DEFAULT_TOSTRING_SUFFIX);
     }
 
     /**
@@ -1427,7 +1416,7 @@ public class IteratorUtils {
     public static <E> String toString(final Iterator<E> iterator,
                                       final Transformer<? super E, String> transformer) {
         return toString(iterator, transformer, DEFAULT_TOSTRING_DELIMITER,
-                        DEFAULT_TOSTRING_PREFIX, DEFAULT_TOSTRING_SUFFIX);
+                CollectionUtils.DEFAULT_TOSTRING_PREFIX, CollectionUtils.DEFAULT_TOSTRING_SUFFIX);
     }
 
     /**
diff --git a/src/main/java/org/apache/commons/collections4/bag/AbstractMapBag.java b/src/main/java/org/apache/commons/collections4/bag/AbstractMapBag.java
index 114968a..4e85fb4 100644
--- a/src/main/java/org/apache/commons/collections4/bag/AbstractMapBag.java
+++ b/src/main/java/org/apache/commons/collections4/bag/AbstractMapBag.java
@@ -28,6 +28,7 @@ import java.util.Map.Entry;
 import java.util.Set;
 
 import org.apache.commons.collections4.Bag;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.set.UnmodifiableSet;
 
 /**
@@ -603,19 +604,19 @@ public abstract class AbstractMapBag<E> implements Bag<E> {
             return "[]";
         }
         final StringBuilder buf = new StringBuilder();
-        buf.append('[');
+        buf.append(CollectionUtils.DEFAULT_TOSTRING_PREFIX);
         final Iterator<E> it = uniqueSet().iterator();
         while (it.hasNext()) {
             final Object current = it.next();
             final int count = getCount(current);
             buf.append(count);
-            buf.append(':');
+            buf.append(CollectionUtils.COLON);
             buf.append(current);
             if (it.hasNext()) {
-                buf.append(',');
+                buf.append(CollectionUtils.COMMA);
             }
         }
-        buf.append(']');
+        buf.append(CollectionUtils.DEFAULT_TOSTRING_SUFFIX);
         return buf.toString();
     }
 
diff --git a/src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java b/src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java
index ec3221f..eb8dff7 100644
--- a/src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java
+++ b/src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java
@@ -407,7 +407,7 @@ public abstract class AbstractLinkedList<E> implements List<E> {
             return "[]";
         }
         final StringBuilder buf = new StringBuilder(16 * size());
-        buf.append('[');
+        buf.append(CollectionUtils.DEFAULT_TOSTRING_PREFIX);
 
         final Iterator<E> it = iterator();
         boolean hasNext = it.hasNext();
@@ -419,7 +419,7 @@ public abstract class AbstractLinkedList<E> implements List<E> {
                 buf.append(", ");
             }
         }
-        buf.append(']');
+        buf.append(CollectionUtils.DEFAULT_TOSTRING_SUFFIX);
         return buf.toString();
     }
 
diff --git a/src/main/java/org/apache/commons/collections4/list/TreeList.java b/src/main/java/org/apache/commons/collections4/list/TreeList.java
index 1b8cda6..82d7ba4 100644
--- a/src/main/java/org/apache/commons/collections4/list/TreeList.java
+++ b/src/main/java/org/apache/commons/collections4/list/TreeList.java
@@ -26,6 +26,7 @@ import java.util.ListIterator;
 import java.util.NoSuchElementException;
 import java.util.Objects;
 
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.OrderedIterator;
 
 /**
@@ -965,11 +966,11 @@ public class TreeList<E> extends AbstractList<E> {
             return new StringBuilder()
                 .append("AVLNode(")
                 .append(relativePosition)
-                .append(',')
+                .append(CollectionUtils.COMMA)
                 .append(left != null)
-                .append(',')
+                .append(CollectionUtils.COMMA)
                 .append(value)
-                .append(',')
+                .append(CollectionUtils.COMMA)
                 .append(getRightSubTree() != null)
                 .append(", faedelung ")
                 .append(rightIsNext)
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 146968c..23e3d67 100644
--- a/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java
+++ b/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java
@@ -30,6 +30,7 @@ import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.Set;
 
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.IterableMap;
 import org.apache.commons.collections4.KeyValue;
 import org.apache.commons.collections4.MapIterator;
@@ -1404,7 +1405,7 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab
 
             hasNext = it.hasNext();
             if (hasNext) {
-                buf.append(',').append(' ');
+                buf.append(CollectionUtils.COMMA).append(' ');
             }
         }
 
diff --git a/src/main/java/org/apache/commons/collections4/map/Flat3Map.java b/src/main/java/org/apache/commons/collections4/map/Flat3Map.java
index fcaa424..4f1e657 100644
--- a/src/main/java/org/apache/commons/collections4/map/Flat3Map.java
+++ b/src/main/java/org/apache/commons/collections4/map/Flat3Map.java
@@ -28,6 +28,7 @@ import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.Set;
 
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.IterableMap;
 import org.apache.commons.collections4.MapIterator;
 import org.apache.commons.collections4.ResettableIterator;
@@ -1262,12 +1263,12 @@ public class Flat3Map<K, V> implements IterableMap<K, V>, Serializable, Cloneabl
             buf.append(key3 == this ? "(this Map)" : key3);
             buf.append('=');
             buf.append(value3 == this ? "(this Map)" : value3);
-            buf.append(',');
+            buf.append(CollectionUtils.COMMA);
         case 2:
             buf.append(key2 == this ? "(this Map)" : key2);
             buf.append('=');
             buf.append(value2 == this ? "(this Map)" : value2);
-            buf.append(',');
+            buf.append(CollectionUtils.COMMA);
         case 1:
             buf.append(key1 == this ? "(this Map)" : key1);
             buf.append('=');


[commons-collections] 03/03: Merge branch 'pr-217'

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

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

commit 86733aae3af073d10c70cfcd2c9b0d99b33cf7aa
Merge: 7ea143a bd67f9a
Author: Bruno P. Kinoshita <ki...@apache.org>
AuthorDate: Fri Mar 5 08:42:24 2021 +1300

    Merge branch 'pr-217'
    
    This closes #217

 src/changes/changes.xml                            |  3 +++
 .../commons/collections4/CollectionUtils.java      | 27 ++++++++++++++++++++++
 .../apache/commons/collections4/IteratorUtils.java | 17 +++-----------
 .../commons/collections4/bag/AbstractMapBag.java   |  9 ++++----
 .../collections4/list/AbstractLinkedList.java      |  4 ++--
 .../apache/commons/collections4/list/TreeList.java |  7 +++---
 .../collections4/map/AbstractHashedMap.java        |  3 ++-
 .../apache/commons/collections4/map/Flat3Map.java  |  5 ++--
 8 files changed, 49 insertions(+), 26 deletions(-)


[commons-collections] 02/03: [COLLECTIONS-785] Add changelog

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

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

commit bd67f9a7b51863c3529052da6d3fba5b7130a690
Author: Bruno P. Kinoshita <ki...@apache.org>
AuthorDate: Fri Mar 5 08:40:06 2021 +1300

    [COLLECTIONS-785] Add changelog
---
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 6d3329b..57bea81 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -256,6 +256,9 @@
     <action type="update" dev="kinow" due-to="Dependabot">
       Bump commons-lang3 from 3.11 to 3.12.0 #219.
     </action>
+    <action issue="COLLECTIONS-785" type="update" dev="kinow" due-to="Arturo Bernal">
+      Add new variables to oac.collections4.CollectionUtils and use them in the code base.
+    </action>
   </release>
   <release version="4.4" date="2019-07-05" description="Maintenance release.">
     <action issue="COLLECTIONS-710" dev="ggregory" type="fix" due-to="Yu Shi, Gary Gregory">