From d7d4c8a4fd8a50bbbac0bf67fa7c422e503a8186 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 5 Jan 2015 23:53:00 +0100 Subject: [PATCH] Use switch-case in Roster.hasValidSubscriptionType() --- .../main/java/org/jivesoftware/smack/Roster.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/Roster.java b/smack-core/src/main/java/org/jivesoftware/smack/Roster.java index 0e2e310d6..8d6e04ec1 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/Roster.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/Roster.java @@ -844,10 +844,15 @@ public class Roster { * This is used by {@link RosterPushListener} and {@link RosterResultListener}. * */ private static boolean hasValidSubscriptionType(RosterPacket.Item item) { - return item.getItemType().equals(RosterPacket.ItemType.none) - || item.getItemType().equals(RosterPacket.ItemType.from) - || item.getItemType().equals(RosterPacket.ItemType.to) - || item.getItemType().equals(RosterPacket.ItemType.both); + switch (item.getItemType()) { + case none: + case from: + case to: + case both: + return true; + default: + return false; + } } private boolean isRosterVersioningSupported() {