diff --git a/src/main/java/io/lettuce/core/dynamic/segment/CommandSegments.java b/src/main/java/io/lettuce/core/dynamic/segment/CommandSegments.java index 115b36b6e8..bf1fad9d42 100644 --- a/src/main/java/io/lettuce/core/dynamic/segment/CommandSegments.java +++ b/src/main/java/io/lettuce/core/dynamic/segment/CommandSegments.java @@ -43,8 +43,8 @@ public CommandSegments(List segments) { LettuceAssert.isTrue(!segments.isEmpty(), "Command segments must not be empty"); - this.segments = segments.size() > 1 ? Collections.unmodifiableList(segments.subList(1, segments.size())) : Collections - .emptyList(); + this.segments = segments.size() > 1 ? Collections.unmodifiableList(segments.subList(1, segments.size())) + : Collections.emptyList(); this.commandType = potentiallyResolveCommand(segments.get(0).asString()); } @@ -102,6 +102,23 @@ public String name() { public String toString() { return name(); } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (!(o instanceof StringCommandType)) + return false; + + StringCommandType that = (StringCommandType) o; + + return commandType.equals(that.commandType); + } + + @Override + public int hashCode() { + return commandType.hashCode(); + } } @Override