We can simplify our equals() implementation a bit, let's do that.
Change-Id: I6b0d18ca1be2762cf5709857975a58a68ace6599
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
a9a4403e92ae551c01ed3acef6e161dafdc132da)
@Override
@SuppressWarnings("checkstyle:equalsHashCode")
public final boolean equals(final Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof Set)) {
- return false;
- }
-
- final Set<?> s = (Set<?>)obj;
- return s.size() == 1 && otherContains(s);
+ return obj == this || obj instanceof Set<?> other && other.size() == 1 && otherContains(other);
}
@SuppressFBWarnings(value = "DCN_NULLPOINTER_EXCEPTION",