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"); }