Use if instead of switch

This commit is contained in:
ahatius 2023-12-04 19:58:17 +01:00 committed by GitHub
parent 365b8ed120
commit d4321971e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -166,21 +166,18 @@ public class GroupStore {
} }
public GroupInfo getGroup(final Connection connection, final GroupId groupId) throws SQLException { public GroupInfo getGroup(final Connection connection, final GroupId groupId) throws SQLException {
switch (groupId) { if (groupId instanceof GroupIdV1) {
case GroupIdV1 groupIdV1 -> { final var group = getGroup(connection, groupIdV1);
final var group = getGroup(connection, groupIdV1);
if (group != null) { if (group != null) {
return group; return group;
} }
return getGroupV2ByV1Id(connection, groupIdV1); return getGroupV2ByV1Id(connection, groupIdV1);
} } else if (groupId instanceOf GroupIdV2) {
case GroupIdV2 groupIdV2 -> { final var group = getGroup(connection, groupIdV2);
final var group = getGroup(connection, groupIdV2);
if (group != null) { if (group != null) {
return group; return group;
} }
return getGroupV1ByV2Id(connection, groupIdV2); return getGroupV1ByV2Id(connection, groupIdV2);
}
} }
} }