Browse Source

remove-Methode implementiert

vollständige_und_weitere_testate
hertero 3 years ago
committed by chris
parent
commit
ba86b4780e
  1. 18
      SimpleArrayMap/src/solution/SimpleArrayMap.java

18
SimpleArrayMap/src/solution/SimpleArrayMap.java

@ -64,7 +64,23 @@ public class SimpleArrayMap<K, V> implements ISimpleMap<K, V> {
@Override
public V remove(K k) {
// TODO Auto-generated method stub
V tempValue;
if (k == null) {
return null;
}
for (int i = 0; i < values.length; i++) {
if (k.equals(keys[i])) {
tempValue = values[i];
keys[i] = null;
values[i] = null;
size--;
return tempValue;
}
}
return null;
}

Loading…
Cancel
Save