Use switch-case in Roster.hasValidSubscriptionType()

This commit is contained in:
Florian Schmaus 2015-01-05 23:53:00 +01:00
parent 61cc6a36da
commit d7d4c8a4fd
1 changed files with 9 additions and 4 deletions

View File

@ -844,10 +844,15 @@ public class Roster {
* This is used by {@link RosterPushListener} and {@link RosterResultListener}. * This is used by {@link RosterPushListener} and {@link RosterResultListener}.
* */ * */
private static boolean hasValidSubscriptionType(RosterPacket.Item item) { private static boolean hasValidSubscriptionType(RosterPacket.Item item) {
return item.getItemType().equals(RosterPacket.ItemType.none) switch (item.getItemType()) {
|| item.getItemType().equals(RosterPacket.ItemType.from) case none:
|| item.getItemType().equals(RosterPacket.ItemType.to) case from:
|| item.getItemType().equals(RosterPacket.ItemType.both); case to:
case both:
return true;
default:
return false;
}
} }
private boolean isRosterVersioningSupported() { private boolean isRosterVersioningSupported() {