From 3a3c4819f9138ca2a939d02a61b332fea9714e0c Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 20 Feb 2024 23:22:34 +0100 Subject: [PATCH] Removed null returns --- .../steamwar/bausystem/features/tracer2/TraceManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java index 5ffc4314..51c8df5d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java @@ -85,8 +85,11 @@ public class TraceManager implements Listener { * @param id id of the trace * @return the trace with given id or null if no trace with id is found */ - public Trace get(int id){ - return traces.getOrDefault(id, null); + public Optional get(int id){ + Trace ret = traces.get(id); + if(traces.containsKey(id)) + return Optional.of(traces.get(id)); + return Optional.empty(); } /** Methode to get all traces