Java 17 features (A-G) (#15516)
- add missing @override - Java style array syntax - remove redundant modifiers - always move String constants to left side in comparisons - simplify lambda expressions and return statements - use replace instead of replaceAll w/o regex - instanceof matching and multiline strings Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
@@ -48,11 +48,11 @@ public class NotificationHandler {
|
||||
public void handleNotification(LocationMessage msg) {
|
||||
synchronized (this) {
|
||||
String trackerId = msg.getTrackerId();
|
||||
if (msg instanceof TransitionMessage) {
|
||||
if (msg instanceof TransitionMessage message) {
|
||||
List<TransitionMessage> transitionMessages = transitionNotifications.computeIfAbsent(trackerId,
|
||||
k -> new ArrayList<>());
|
||||
if (transitionMessages != null) {
|
||||
transitionMessages.add((TransitionMessage) msg);
|
||||
transitionMessages.add(message);
|
||||
}
|
||||
} else {
|
||||
locationNotifications.put(trackerId, msg);
|
||||
|
||||
@@ -120,9 +120,8 @@ public abstract class AbstractCallbackServlet extends HttpServlet {
|
||||
if (!trackerId.isEmpty()) {
|
||||
TrackerHandler recorder = getHandlerById(trackerId);
|
||||
if (recorder != null) {
|
||||
if (message instanceof TransitionMessage) {
|
||||
TransitionMessage tm = (TransitionMessage) message;
|
||||
recorder.doTransition(tm);
|
||||
if (message instanceof TransitionMessage transitionMessage) {
|
||||
recorder.doTransition(transitionMessage);
|
||||
} else {
|
||||
recorder.updateLocation(message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user