Skip to content

Commit 9b7e169

Browse files
committed
MiscUtils: use more succinct code for equal method
One thousand thanks to Johannes Schindelin for the inspiration!!
1 parent 4e40c81 commit 9b7e169

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/main/java/org/scijava/util/MiscUtils.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ public static <T extends Comparable<? super T>> int compare(final T o1,
9191
* {@code o1.equals(o2)} holds.
9292
*/
9393
public static boolean equal(final Object o1, final Object o2) {
94-
if (o1 == null && o2 == null) return true;
95-
if (o1 == null || o2 == null) return false;
96-
return o1.equals(o2);
94+
return o1 == null ? o2 == null : o1.equals(o2);
9795
}
9896

9997
}

0 commit comments

Comments
 (0)