You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2019/08/21 09:24:04 UTC
[groovy] 04/11: Use Objects.equals to compare Boolean
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 5fc311a69137e2406f15bc25b5d61870b28d26d3
Author: Bo Zhang <zh...@gmail.com>
AuthorDate: Sat Aug 17 19:17:52 2019 +0800
Use Objects.equals to compare Boolean
---
src/main/java/groovy/lang/IntRange.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/java/groovy/lang/IntRange.java b/src/main/java/groovy/lang/IntRange.java
index b1cfb2e..2cf80c4 100644
--- a/src/main/java/groovy/lang/IntRange.java
+++ b/src/main/java/groovy/lang/IntRange.java
@@ -28,6 +28,7 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
+import java.util.Objects;
/**
* Represents a list of Integer objects starting at a specified {@code from} value up (or down)
@@ -262,7 +263,7 @@ public class IntRange extends AbstractList<Integer> implements Range<Integer>, S
*/
public boolean equals(IntRange that) {
return that != null && ((inclusive == null && reverse == that.reverse && from == that.from && to == that.to)
- || (inclusive != null && inclusive == that.inclusive && from == that.from && to == that.to));
+ || (inclusive != null && Objects.equals(inclusive, that.inclusive) && from == that.from && to == that.to));
}
@Override