From 71424a86019e455d142a10e87d7516b76caf9314 Mon Sep 17 00:00:00 2001 From: hertero Date: Thu, 1 Sep 2022 11:38:03 +0200 Subject: [PATCH] forEach-Methode implementiert --- SimpleArrayMap/src/solution/SimpleArrayMap.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SimpleArrayMap/src/solution/SimpleArrayMap.java b/SimpleArrayMap/src/solution/SimpleArrayMap.java index d375246..86580b4 100644 --- a/SimpleArrayMap/src/solution/SimpleArrayMap.java +++ b/SimpleArrayMap/src/solution/SimpleArrayMap.java @@ -102,8 +102,12 @@ public class SimpleArrayMap implements ISimpleMap { @Override public void forEach(Consumer consumer) { - // TODO Auto-generated method stub - + + for (int i = 0; i < values.length; i++) { + if (keys[i] != null) { + consumer.accept(values[i]); + } + } } @Override