From 422005b9da2970a7388d7a2ba0a333d8d39dc0ae Mon Sep 17 00:00:00 2001 From: hertero Date: Thu, 1 Sep 2022 11:37:42 +0200 Subject: [PATCH] contains-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 e8cef81..d375246 100644 --- a/SimpleArrayMap/src/solution/SimpleArrayMap.java +++ b/SimpleArrayMap/src/solution/SimpleArrayMap.java @@ -86,7 +86,17 @@ public class SimpleArrayMap implements ISimpleMap { @Override public boolean contains(V v) { - // TODO Auto-generated method stub + + if (v == null) { + return false; + } + + for (int i = 0; i < values.length; i++) { + if (v.equals(values[i])) { + return true; + } + } + return false; }