| 1 | package g0803.bindingofshiba.bundles; | |
| 2 | ||
| 3 | import java.util.HashMap; | |
| 4 | import java.util.Set; | |
| 5 | ||
| 6 | public class HashMapBundle<T> implements Bundle<T> { | |
| 7 | ||
| 8 | private final HashMap<String, T> bundle = new HashMap<>(); | |
| 9 | ||
| 10 | @Override | |
| 11 | public void register(String name, T data) { | |
| 12 | bundle.put(name, data); | |
| 13 | } | |
| 14 | ||
| 15 | @Override | |
| 16 | public T get(String name) { | |
| 17 |
1
1. get : negated conditional → KILLED |
if (!bundle.containsKey(name)) |
| 18 | throw new IllegalArgumentException("Key " + name + " not found in bundle"); | |
| 19 | ||
| 20 |
1
1. get : replaced return value with null for g0803/bindingofshiba/bundles/HashMapBundle::get → KILLED |
return bundle.get(name); |
| 21 | } | |
| 22 | ||
| 23 | @Override | |
| 24 | public Set<String> keys() { | |
| 25 |
1
1. keys : replaced return value with Collections.emptySet for g0803/bindingofshiba/bundles/HashMapBundle::keys → KILLED |
return bundle.keySet(); |
| 26 | } | |
| 27 | } | |
Mutations | ||
| 17 |
1.1 |
|
| 20 |
1.1 |
|
| 25 |
1.1 |