From 2005fd55347816cf4a86b66ae97bc245f53f0bcd Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 6 Jul 2024 19:47:06 -0700 Subject: Update switch statements --- .../org/traccar/protocol/B2316ProtocolDecoder.java | 41 ++++++++-------------- 1 file changed, 15 insertions(+), 26 deletions(-) (limited to 'src/main/java/org/traccar/protocol/B2316ProtocolDecoder.java') diff --git a/src/main/java/org/traccar/protocol/B2316ProtocolDecoder.java b/src/main/java/org/traccar/protocol/B2316ProtocolDecoder.java index b0a5411f7..a0c059898 100644 --- a/src/main/java/org/traccar/protocol/B2316ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/B2316ProtocolDecoder.java @@ -40,35 +40,24 @@ public class B2316ProtocolDecoder extends BaseProtocolDecoder { } private String decodeAlarm(int value) { - switch (value) { - case 1: - return Position.ALARM_LOW_BATTERY; - case 2: - return Position.ALARM_SOS; - case 3: - return Position.ALARM_POWER_OFF; - case 4: - return Position.ALARM_REMOVING; - default: - return null; - } + return switch (value) { + case 1 -> Position.ALARM_LOW_BATTERY; + case 2 -> Position.ALARM_SOS; + case 3 -> Position.ALARM_POWER_OFF; + case 4 -> Position.ALARM_REMOVING; + default -> null; + }; } private Integer decodeBattery(int value) { - switch (value) { - case 0: - return 10; - case 1: - return 30; - case 2: - return 60; - case 3: - return 80; - case 4: - return 100; - default: - return null; - } + return switch (value) { + case 0 -> 10; + case 1 -> 30; + case 2 -> 60; + case 3 -> 80; + case 4 -> 100; + default -> null; + }; } @Override -- cgit v1.2.3