public MapArray<K, V> update(K key, Function<V, V> func) { V value = null; if (hasKey(key)) { value = get(key); removeByKey(key); } pairs.add(new Pair<>(key, func.apply(value))); return this; }
public void addOrReplace(K key, V value) { if (hasKey(key)) removeByKey(key); add(key, value); }
public MapArray<K, V> update(K key, V value) { if (hasKey(key)) removeByKey(key); pairs.add(new Pair<>(key, value)); return this; }