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 2020/11/20 21:59:28 UTC

[commons-collections] branch master updated: Use Arrays.fill().

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


The following commit(s) were added to refs/heads/master by this push:
     new 84aa4fe  Use Arrays.fill().
84aa4fe is described below

commit 84aa4fe4f067d72aedb54cf8c331bb37f4e52b3a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Nov 20 16:59:24 2020 -0500

    Use Arrays.fill().
---
 .../java/org/apache/commons/collections4/map/AbstractHashedMap.java  | 5 ++---
 1 file changed, 2 insertions(+), 3 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 b4acad6..2610922 100644
--- a/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java
+++ b/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java
@@ -22,6 +22,7 @@ import java.io.ObjectOutputStream;
 import java.util.AbstractCollection;
 import java.util.AbstractMap;
 import java.util.AbstractSet;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.ConcurrentModificationException;
 import java.util.Iterator;
@@ -362,9 +363,7 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab
     public void clear() {
         modCount++;
         final HashEntry<K, V>[] data = this.data;
-        for (int i = data.length - 1; i >= 0; i--) {
-            data[i] = null;
-        }
+        Arrays.fill(data, null);
         size = 0;
     }