diff --git a/src/main/java/org/apache/commons/collections4/iterators/NodeListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/NodeListIterator.java index a76c1a29e..5d372b578 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/NodeListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/NodeListIterator.java @@ -67,7 +67,7 @@ public class NodeListIterator implements Iterator { @Override public boolean hasNext() { - return nodeList == null ? false : index < nodeList.getLength(); + return nodeList != null && index < nodeList.getLength(); } @Override diff --git a/src/main/java/org/apache/commons/collections4/iterators/PeekingIterator.java b/src/main/java/org/apache/commons/collections4/iterators/PeekingIterator.java index 94cd2c389..038e7dd0b 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/PeekingIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/PeekingIterator.java @@ -97,7 +97,7 @@ public class PeekingIterator implements Iterator { if (exhausted) { return false; } - return slotFilled ? true : iterator.hasNext(); + return slotFilled || iterator.hasNext(); } /** diff --git a/src/main/java/org/apache/commons/collections4/iterators/PushbackIterator.java b/src/main/java/org/apache/commons/collections4/iterators/PushbackIterator.java index 031153b82..a425bc191 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/PushbackIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/PushbackIterator.java @@ -88,7 +88,7 @@ public class PushbackIterator implements Iterator { @Override public boolean hasNext() { - return !items.isEmpty() ? true : iterator.hasNext(); + return !items.isEmpty() || iterator.hasNext(); } @Override diff --git a/src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java b/src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java index 50c3e12bd..059bee3a2 100644 --- a/src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java +++ b/src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java @@ -435,7 +435,7 @@ public abstract class AbstractLinkedList implements List { * @return true if equal */ protected boolean isEqualValue(final Object value1, final Object value2) { - return value1 == value2 || (value1 == null ? false : value1.equals(value2)); + return value1 == value2 || (value1 != null && value1.equals(value2)); } /** diff --git a/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java b/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java index 7bee60ebd..3599073d4 100644 --- a/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java +++ b/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java @@ -461,19 +461,19 @@ public abstract class AbstractMultiValuedMap implements MultiValuedMap coll = getMapping(); - return coll == null ? false : coll.contains(obj); + return coll != null && coll.contains(obj); } @Override public boolean containsAll(final Collection other) { final Collection coll = getMapping(); - return coll == null ? false : coll.containsAll(other); + return coll != null && coll.containsAll(other); } @Override public boolean isEmpty() { final Collection coll = getMapping(); - return coll == null ? true : coll.isEmpty(); + return coll == null || coll.isEmpty(); } @Override