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 df0b07b  Use isEmpty().
df0b07b is described below

commit df0b07b8cf64ca16c55260a8cd9dcfaced4909c2
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Jan 16 22:30:02 2021 -0500

    Use isEmpty().
---
 .../apache/commons/jcs/auxiliary/javagroups/JavaGroupsCache.java    | 2 +-
 .../commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java       | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/auxiliary-builds/javagroups/src/java/org/apache/commons/jcs/auxiliary/javagroups/JavaGroupsCache.java
 
b/auxiliary-builds/javagroups/src/java/org/apache/commons/jcs/auxiliary/javagroups/JavaGroupsCache.java
index 9e7f654..6176678 100644
--- 
a/auxiliary-builds/javagroups/src/java/org/apache/commons/jcs/auxiliary/javagroups/JavaGroupsCache.java
+++ 
b/auxiliary-builds/javagroups/src/java/org/apache/commons/jcs/auxiliary/javagroups/JavaGroupsCache.java
@@ -174,7 +174,7 @@ public class JavaGroupsCache
 
             // If there were any non null results, return the first
 
-            if ( results.size() > 0 )
+            if ( !results.isEmpty() )
             {
                 return ( ICacheElement<K, V> ) results.get( 0 );
             }
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 0d5f1c4..7bcf15a 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
@@ -187,7 +187,7 @@ public class IndexedDiskCache<K, V> extends 
AbstractDiskCache<K, V>
             log.info("{0}: Indexed Disk Cache is alive.", logCacheName);
 
             // TODO: Should we improve detection of whether or not the file 
should be optimized.
-            if (isRealTimeOptimizationEnabled && keyHash.size() > 0)
+            if (isRealTimeOptimizationEnabled && !keyHash.isEmpty())
             {
                 // Kick off a real time optimization, in case we didn't do a 
final optimization.
                 doOptimizeRealTime();
@@ -438,7 +438,7 @@ public class IndexedDiskCache<K, V> extends 
AbstractDiskCache<K, V>
             keyFile.reset();
 
             final HashMap<K, IndexedDiskElementDescriptor> keys = new 
HashMap<>(keyHash);
-            if (keys.size() > 0)
+            if (!keys.isEmpty())
             {
                 keyFile.writeObject(keys, 0);
             }
@@ -1636,7 +1636,7 @@ public class IndexedDiskCache<K, V> extends 
AbstractDiskCache<K, V>
         @Override
         protected boolean shouldRemove()
         {
-            return maxSize > 0 && contentSize.get() > maxSize && this.size() > 
0;
+            return maxSize > 0 && contentSize.get() > maxSize && 
!this.isEmpty();
         }
     }
 

Reply via email to