Skip to content

Commit d763d33

Browse files
xzel23svanteschubert
authored andcommitted
simplify the equals() code
1 parent f468114 commit d763d33

File tree

1 file changed

+3
-11
lines changed
  • odfdom/src/main/java/org/odftoolkit/odfdom/type

1 file changed

+3
-11
lines changed

odfdom/src/main/java/org/odftoolkit/odfdom/type/Color.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.odftoolkit.odfdom.type;
2020

2121
import java.util.Map;
22+
import java.util.Objects;
2223
import java.util.regex.Pattern;
2324

2425
/**
@@ -365,19 +366,10 @@ private static int mapColorValueToInteger(String colorValue) {
365366

366367
@Override
367368
public boolean equals(Object obj) {
368-
if (obj == null) {
369+
if (obj == null || getClass() != obj.getClass()) {
369370
return false;
370371
}
371-
if (getClass() != obj.getClass()) {
372-
return false;
373-
}
374-
final Color other = (Color) obj;
375-
if ((this.mColorAsSixHexRGB == null)
376-
? (other.mColorAsSixHexRGB != null)
377-
: !this.mColorAsSixHexRGB.equals(other.mColorAsSixHexRGB)) {
378-
return false;
379-
}
380-
return true;
372+
return Objects.equals(this.mColorAsSixHexRGB, ((Color) obj).mColorAsSixHexRGB);
381373
}
382374

383375
@Override

0 commit comments

Comments
 (0)