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 2022/11/25 14:54:09 UTC

[commons-jcs] branch master updated: Use toArray() with 0 size array pattern

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-jcs.git


The following commit(s) were added to refs/heads/master by this push:
     new 300a8f40 Use toArray() with 0 size array pattern
     new 4adeba98 Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-jcs
300a8f40 is described below

commit 300a8f40ecd633bdda4f56be337f1d452ae6813e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Nov 25 09:53:39 2022 -0500

    Use toArray() with 0 size array pattern
---
 .../apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java  | 2 +-
 .../commons/jcs3/auxiliary/lateral/LateralCacheNoWaitFacade.java      | 2 +-
 .../main/java/org/apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java
index f63638d5..9ffb002b 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java
@@ -1153,7 +1153,7 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V>
             {
                 if (!queuedPutList.isEmpty())
                 {
-                    defragList = queuedPutList.toArray(new IndexedDiskElementDescriptor[queuedPutList.size()]);
+                    defragList = queuedPutList.toArray(new IndexedDiskElementDescriptor[0]);
 
                     // pack them at the end
                     expectedNextPos = defragFile(defragList, expectedNextPos);
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWaitFacade.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWaitFacade.java
index 0ef7aa74..bc13671f 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWaitFacade.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWaitFacade.java
@@ -110,7 +110,7 @@ public class LateralCacheNoWaitFacade<K, V>
     {
         log.debug( "CONSTRUCTING NO WAIT FACADE" );
         this.listener = listener;
-        this.noWaits = noWaits.toArray(new LateralCacheNoWait[noWaits.size()]);
+        this.noWaits = noWaits.toArray(new LateralCacheNoWait[0]);
         this.noWaitMap = new ConcurrentHashMap<>();
         noWaits.forEach(noWait -> noWaitMap.put(noWait.getIdentityKey(), noWait));
         this.cacheName = cattr.getCacheName();
diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java
index eaba5270..28b5c3ce 100644
--- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java
+++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java
@@ -205,7 +205,7 @@ public class CDIJCacheHelper
                 list.add(i);
             }
         }
-        return list.toArray(new Integer[list.size()]);
+        return list.toArray(new Integer[0]);
     }
 
     private Integer getValueParameter(final List<Set<Annotation>> annotations)
@@ -436,7 +436,7 @@ public class CDIJCacheHelper
                 }
             }
         }
-        return keys.toArray(new Integer[keys.size()]);
+        return keys.toArray(new Integer[0]);
     }
 
     private static final class MethodKey