From c454fa7b0f7bd8dc95f52902c975a2bdac2eaf96 Mon Sep 17 00:00:00 2001 From: Mark Rotteveel Date: Tue, 26 Sep 2023 12:39:35 +0200 Subject: [PATCH] Simplify code --- .../jaybird/props/def/ConnectionProperty.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/org/firebirdsql/jaybird/props/def/ConnectionProperty.java b/src/main/org/firebirdsql/jaybird/props/def/ConnectionProperty.java index 0a08ca7ec..75e4dfcdb 100644 --- a/src/main/org/firebirdsql/jaybird/props/def/ConnectionProperty.java +++ b/src/main/org/firebirdsql/jaybird/props/def/ConnectionProperty.java @@ -32,7 +32,6 @@ import static java.util.Collections.*; import static java.util.Objects.requireNonNull; -import static java.util.stream.Collectors.toList; import static org.firebirdsql.jaybird.util.StringUtils.trimToNull; /** @@ -241,12 +240,7 @@ public String toString() { */ @Override public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof ConnectionProperty)) return false; - - ConnectionProperty that = (ConnectionProperty) o; - - return name.equals(that.name); + return this == o || o instanceof ConnectionProperty that && name.equals(that.name); } /** @@ -296,8 +290,8 @@ private static List normalizeValues(List values) { List normalizedValues = values.stream() .map(StringUtils::trimToNull) .filter(Objects::nonNull) - .collect(toList()); - return normalizedValues.isEmpty() ? emptyList() : unmodifiableList(normalizedValues); + .toList(); + return normalizedValues.isEmpty() ? emptyList() : normalizedValues; } public static final class Builder {