Fix PMD issue regarding Ternary operators that can be simplified

This commit is contained in:
Bruno P. Kinoshita 2019-02-16 21:51:21 +13:00
parent 2da1b2f60d
commit 9f45dc09e3
5 changed files with 7 additions and 7 deletions

View File

@ -67,7 +67,7 @@ public class NodeListIterator implements Iterator<Node> {
@Override
public boolean hasNext() {
return nodeList == null ? false : index < nodeList.getLength();
return nodeList != null && index < nodeList.getLength();
}
@Override

View File

@ -97,7 +97,7 @@ public class PeekingIterator<E> implements Iterator<E> {
if (exhausted) {
return false;
}
return slotFilled ? true : iterator.hasNext();
return slotFilled || iterator.hasNext();
}
/**

View File

@ -88,7 +88,7 @@ public class PushbackIterator<E> implements Iterator<E> {
@Override
public boolean hasNext() {
return !items.isEmpty() ? true : iterator.hasNext();
return !items.isEmpty() || iterator.hasNext();
}
@Override

View File

@ -435,7 +435,7 @@ public abstract class AbstractLinkedList<E> implements List<E> {
* @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));
}
/**

View File

@ -461,19 +461,19 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
@Override
public boolean contains(final Object obj) {
final Collection<V> coll = getMapping();
return coll == null ? false : coll.contains(obj);
return coll != null && coll.contains(obj);
}
@Override
public boolean containsAll(final Collection<?> other) {
final Collection<V> coll = getMapping();
return coll == null ? false : coll.containsAll(other);
return coll != null && coll.containsAll(other);
}
@Override
public boolean isEmpty() {
final Collection<V> coll = getMapping();
return coll == null ? true : coll.isEmpty();
return coll == null || coll.isEmpty();
}
@Override