diff --git a/.idea/inspectionProfiles/3_Consistent_Style.xml b/.idea/inspectionProfiles/3_Consistent_Style.xml index c8f1e08139..c7ef266320 100644 --- a/.idea/inspectionProfiles/3_Consistent_Style.xml +++ b/.idea/inspectionProfiles/3_Consistent_Style.xml @@ -3297,7 +3297,7 @@ - + diff --git a/.idea/inspectionProfiles/IDE.xml b/.idea/inspectionProfiles/IDE.xml index 82e9c7d2e6..54b36011ab 100644 --- a/.idea/inspectionProfiles/IDE.xml +++ b/.idea/inspectionProfiles/IDE.xml @@ -936,6 +936,7 @@ + diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/bimap/mutable/AbstractMutableBiMap.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/bimap/mutable/AbstractMutableBiMap.java index aeb85448bd..ca904785ca 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/bimap/mutable/AbstractMutableBiMap.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/bimap/mutable/AbstractMutableBiMap.java @@ -115,16 +115,12 @@ private static boolean nullSafeEquals(Object value, Object other) { if (value == null) { - if (other == null) - { - return true; - } + return other == null; } - else if (other == value || value.equals(other)) + else { - return true; + return other == value || value.equals(other); } - return false; } @Override diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/ConcurrentHashMap.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/ConcurrentHashMap.java index 9c40c93199..aed11f7dd9 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/ConcurrentHashMap.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/ConcurrentHashMap.java @@ -1856,10 +1856,7 @@ public boolean equals(Object o) { V v1 = this.value; Object v2 = e.getValue(); - if (v1 == v2 || v1 != null && v1.equals(v2)) - { - return true; - } + return v1 == v2 || v1 != null && v1.equals(v2); } return false; } diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/ConcurrentHashMapUnsafe.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/ConcurrentHashMapUnsafe.java index 2df02e36ab..98327bdc08 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/ConcurrentHashMapUnsafe.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/ConcurrentHashMapUnsafe.java @@ -1969,10 +1969,7 @@ public boolean equals(Object o) { V v1 = this.value; Object v2 = e.getValue(); - if (v1 == v2 || v1 != null && v1.equals(v2)) - { - return true; - } + return v1 == v2 || v1 != null && v1.equals(v2); } return false; } diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/UnifiedMap.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/UnifiedMap.java index 7dc5e4dafa..1f80a9d44d 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/UnifiedMap.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/UnifiedMap.java @@ -2539,16 +2539,12 @@ private static boolean nullSafeEquals(Object value, Object other) { if (value == null) { - if (other == null) - { - return true; - } + return other == null; } - else if (other == value || value.equals(other)) + else { - return true; + return other == value || value.equals(other); } - return false; } protected class EntrySet implements Set>, Serializable, BatchIterable> diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/primitive/ObjectBooleanHashMap.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/primitive/ObjectBooleanHashMap.java index 1693209e5a..01dc74ccd4 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/primitive/ObjectBooleanHashMap.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/primitive/ObjectBooleanHashMap.java @@ -1053,16 +1053,12 @@ private static boolean nullSafeEquals(Object value, Object other) { if (value == null) { - if (other == null) - { - return true; - } + return other == null; } - else if (other == value || value.equals(other)) + else { - return true; + return other == value || value.equals(other); } - return false; } private K toNonSentinel(Object key) diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/primitive/ObjectBooleanHashMapWithHashingStrategy.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/primitive/ObjectBooleanHashMapWithHashingStrategy.java index 957c0f401e..13cb86c489 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/primitive/ObjectBooleanHashMapWithHashingStrategy.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/mutable/primitive/ObjectBooleanHashMapWithHashingStrategy.java @@ -1072,17 +1072,11 @@ private boolean nullSafeEquals(K key, Object other) { if (key == null) { - if (other == null) - { - return true; - } + return other == null; } else if (key != NULL_KEY && other != null) { - if (this.hashingStrategy.equals(key, this.toNonSentinel(other))) - { - return true; - } + return this.hashingStrategy.equals(key, this.toNonSentinel(other)); } return false; } diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/strategy/mutable/UnifiedMapWithHashingStrategy.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/strategy/mutable/UnifiedMapWithHashingStrategy.java index e6a5289c93..438fde738f 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/strategy/mutable/UnifiedMapWithHashingStrategy.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/map/strategy/mutable/UnifiedMapWithHashingStrategy.java @@ -2268,16 +2268,12 @@ private static boolean nullSafeEquals(Object value, Object other) { if (value == null) { - if (other == null) - { - return true; - } + return other == null; } - else if (other == value || value.equals(other)) + else { - return true; + return other == value || value.equals(other); } - return false; } protected class EntrySet implements Set>, Serializable, BatchIterable> diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/string/immutable/CodePointAdapter.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/string/immutable/CodePointAdapter.java index c6c5b575cb..5cb8439cdb 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/string/immutable/CodePointAdapter.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/string/immutable/CodePointAdapter.java @@ -702,11 +702,7 @@ public boolean equalsIntList(IntList list) } i += Character.charCount(codePoint); } - if (size < list.size()) - { - return false; - } - return true; + return size >= list.size(); } private boolean equalsCodePointAdapter(CodePointAdapter adapter) diff --git a/unit-tests-java8/src/test/java/org/eclipse/collections/test/domain/B.java b/unit-tests-java8/src/test/java/org/eclipse/collections/test/domain/B.java index bcab9a1e15..33e021357d 100644 --- a/unit-tests-java8/src/test/java/org/eclipse/collections/test/domain/B.java +++ b/unit-tests-java8/src/test/java/org/eclipse/collections/test/domain/B.java @@ -45,12 +45,7 @@ public boolean equals(Object o) B b = (B) o; - if (this.i != b.i) - { - return false; - } - - return true; + return this.i == b.i; } @Override diff --git a/unit-tests-java8/src/test/java/org/eclipse/collections/test/domain/C.java b/unit-tests-java8/src/test/java/org/eclipse/collections/test/domain/C.java index 02f1ed31bb..7eaac528aa 100644 --- a/unit-tests-java8/src/test/java/org/eclipse/collections/test/domain/C.java +++ b/unit-tests-java8/src/test/java/org/eclipse/collections/test/domain/C.java @@ -45,12 +45,7 @@ public boolean equals(Object o) C c = (C) o; - if (Double.compare(c.d, this.d) != 0) - { - return false; - } - - return true; + return Double.compare(c.d, this.d) == 0; } @Override diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/test/domain/Person.java b/unit-tests/src/test/java/org/eclipse/collections/impl/test/domain/Person.java index e365f37080..573e779eba 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/test/domain/Person.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/test/domain/Person.java @@ -61,12 +61,7 @@ public boolean equals(Object o) { return false; } - if (!this.lastName.equals(person.lastName)) - { - return false; - } - - return true; + return this.lastName.equals(person.lastName); } @Override