From d917de3b8c423db7ccee207e54cbb18c5ffbda40 Mon Sep 17 00:00:00 2001 From: hertero Date: Thu, 1 Sep 2022 11:37:11 +0200 Subject: [PATCH] get-Methode implementiert --- SimpleArrayMap/src/solution/SimpleArrayMap.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/SimpleArrayMap/src/solution/SimpleArrayMap.java b/SimpleArrayMap/src/solution/SimpleArrayMap.java index ba03245..208d1ec 100644 --- a/SimpleArrayMap/src/solution/SimpleArrayMap.java +++ b/SimpleArrayMap/src/solution/SimpleArrayMap.java @@ -48,7 +48,17 @@ public class SimpleArrayMap implements ISimpleMap { @Override public V get(K k) { - // TODO Auto-generated method stub + + if (k == null) { + return null; + } + + for (int i = 0; i < values.length; i++) { + if (k.equals(keys[i])) { + return values[i]; + } + } + return null; }