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 --- src/main/java/org/traccar/session/ConnectionManager.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/main/java/org/traccar/session/ConnectionManager.java') diff --git a/src/main/java/org/traccar/session/ConnectionManager.java b/src/main/java/org/traccar/session/ConnectionManager.java index 8431a0327..a80c6aad1 100644 --- a/src/main/java/org/traccar/session/ConnectionManager.java +++ b/src/main/java/org/traccar/session/ConnectionManager.java @@ -241,17 +241,11 @@ public class ConnectionManager implements BroadcastInterface { if (!status.equals(oldStatus)) { String eventType; Map events = new HashMap<>(); - switch (status) { - case Device.STATUS_ONLINE: - eventType = Event.TYPE_DEVICE_ONLINE; - break; - case Device.STATUS_UNKNOWN: - eventType = Event.TYPE_DEVICE_UNKNOWN; - break; - default: - eventType = Event.TYPE_DEVICE_OFFLINE; - break; - } + eventType = switch (status) { + case Device.STATUS_ONLINE -> Event.TYPE_DEVICE_ONLINE; + case Device.STATUS_UNKNOWN -> Event.TYPE_DEVICE_UNKNOWN; + default -> Event.TYPE_DEVICE_OFFLINE; + }; events.put(new Event(eventType, deviceId), null); notificationManager.updateEvents(events); } -- cgit v1.2.3