From d4321971e39ac5435f2a34376d0082bab6012a6c Mon Sep 17 00:00:00 2001 From: ahatius Date: Mon, 4 Dec 2023 19:58:17 +0100 Subject: [PATCH] Use if instead of switch --- .../signal/manager/storage/groups/GroupStore.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupStore.java b/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupStore.java index 33bb2532..ea765521 100644 --- a/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupStore.java +++ b/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupStore.java @@ -166,21 +166,18 @@ public class GroupStore { } public GroupInfo getGroup(final Connection connection, final GroupId groupId) throws SQLException { - switch (groupId) { - case GroupIdV1 groupIdV1 -> { - final var group = getGroup(connection, groupIdV1); + if (groupId instanceof GroupIdV1) { + final var group = getGroup(connection, groupIdV1); if (group != null) { return group; } return getGroupV2ByV1Id(connection, groupIdV1); - } - case GroupIdV2 groupIdV2 -> { - final var group = getGroup(connection, groupIdV2); + } else if (groupId instanceOf GroupIdV2) { + final var group = getGroup(connection, groupIdV2); if (group != null) { return group; } return getGroupV1ByV2Id(connection, groupIdV2); - } } }