Simplify BagOfPrimitives if statement (#1539)

* Simplify BagOfPrimitives if statement

* formatting
This commit is contained in:
William Collishaw 2019-06-04 12:03:45 -06:00 committed by inder123
parent 49d8630978
commit aa236ec38d

View File

@ -66,25 +66,18 @@ public class BagOfPrimitives {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj) return true;
return true; if (obj == null) return false;
if (obj == null) if (getClass() != obj.getClass()) return false;
return false;
if (getClass() != obj.getClass())
return false;
BagOfPrimitives other = (BagOfPrimitives) obj; BagOfPrimitives other = (BagOfPrimitives) obj;
if (booleanValue != other.booleanValue) if (booleanValue != other.booleanValue) return false;
return false; if (intValue != other.intValue) return false;
if (intValue != other.intValue) if (longValue != other.longValue) return false;
return false;
if (longValue != other.longValue)
return false;
if (stringValue == null) { if (stringValue == null) {
if (other.stringValue != null) return other.stringValue == null;
return false; } else {
} else if (!stringValue.equals(other.stringValue)) return stringValue.equals(other.stringValue);
return false; }
return true;
} }
@Override @Override