From 23730a0fb858372095913db1ab998964e32d5240 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sat, 16 Jan 2021 21:48:58 -0500 Subject: [PATCH] Use isEmpty(). --- .../apache/commons/collections4/map/AbstractReferenceMap.java | 2 +- .../java/org/apache/commons/collections4/map/CompositeMap.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java index 84fd2d992..4fd244583 100644 --- a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java +++ b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java @@ -795,7 +795,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap ReferenceBaseIterator(final AbstractReferenceMap parent) { this.parent = parent; - index = parent.size() != 0 ? parent.data.length : 0; + index = !parent.isEmpty() ? parent.data.length : 0; // have to do this here! size() invocation above // may have altered the modCount. expectedModCount = parent.modCount; diff --git a/src/main/java/org/apache/commons/collections4/map/CompositeMap.java b/src/main/java/org/apache/commons/collections4/map/CompositeMap.java index 3aad89102..c9bffcf87 100644 --- a/src/main/java/org/apache/commons/collections4/map/CompositeMap.java +++ b/src/main/java/org/apache/commons/collections4/map/CompositeMap.java @@ -139,7 +139,7 @@ public class CompositeMap extends AbstractIterableMap implements Ser if (map != null) { for (int i = composite.length - 1; i >= 0; --i) { final Collection intersect = CollectionUtils.intersection(this.composite[i].keySet(), map.keySet()); - if (intersect.size() != 0) { + if (!intersect.isEmpty()) { if (this.mutator == null) { throw new IllegalArgumentException("Key collision adding Map to CompositeMap"); }