From 2cda9446434dc6ec7c65d7aad66a2e72e0258cb5 Mon Sep 17 00:00:00 2001
From: Piotr Idzik <65706193+vil02@users.noreply.github.com>
Date: Tue, 28 May 2024 21:03:52 +0200
Subject: [PATCH] style: include `ENMI_EQUALS_ON_ENUM` (#5189)
---
spotbugs-exclude.xml | 3 ---
.../com/thealgorithms/datastructures/crdt/LWWElementSet.java | 4 ++--
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml
index 99a24bbff..45ea8ed05 100644
--- a/spotbugs-exclude.xml
+++ b/spotbugs-exclude.xml
@@ -222,9 +222,6 @@
-
-
-
diff --git a/src/main/java/com/thealgorithms/datastructures/crdt/LWWElementSet.java b/src/main/java/com/thealgorithms/datastructures/crdt/LWWElementSet.java
index b8b296359..2c6ce8a42 100644
--- a/src/main/java/com/thealgorithms/datastructures/crdt/LWWElementSet.java
+++ b/src/main/java/com/thealgorithms/datastructures/crdt/LWWElementSet.java
@@ -124,14 +124,14 @@ class LWWElementSet {
* @return True if the first element's timestamp is greater or the bias is ADDS and timestamps are equal.
*/
public boolean compareTimestamps(Element e, Element other) {
- if (!e.bias.equals(other.bias)) {
+ if (e.bias != other.bias) {
throw new IllegalArgumentException("Invalid bias value");
}
Bias bias = e.bias;
int timestampComparison = Integer.compare(e.timestamp, other.timestamp);
if (timestampComparison == 0) {
- return !bias.equals(Bias.ADDS);
+ return bias != Bias.ADDS;
}
return timestampComparison < 0;
}