From 33f381dc13a0954e6dc951f58342ba2ba9cb2de0 Mon Sep 17 00:00:00 2001 From: carrot Date: Tue, 20 Feb 2024 02:49:46 +0300 Subject: [PATCH] SetParams should implement equals and hashcode --- .../redis/clients/jedis/params/SetParams.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/redis/clients/jedis/params/SetParams.java b/src/main/java/redis/clients/jedis/params/SetParams.java index b0e43103277..11f368f3dea 100644 --- a/src/main/java/redis/clients/jedis/params/SetParams.java +++ b/src/main/java/redis/clients/jedis/params/SetParams.java @@ -3,6 +3,8 @@ import redis.clients.jedis.CommandArguments; import redis.clients.jedis.Protocol.Keyword; +import java.util.Objects; + public class SetParams implements IParams { private Keyword existance; @@ -106,4 +108,18 @@ public void addParams(CommandArguments args) { } } } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SetParams setParams = (SetParams) o; + return Objects.equals(existance, setParams.existance) && Objects.equals(expiration, setParams.expiration) + && Objects.equals(expirationValue, setParams.expirationValue); + } + + @Override + public int hashCode() { + return Objects.hash(existance, expiration, expirationValue); + } }