Beispiel #1
0
 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;
 }
Beispiel #2
0
 public void addOrReplace(K key, V value) {
   if (hasKey(key)) removeByKey(key);
   add(key, value);
 }
Beispiel #3
0
 public MapArray<K, V> update(K key, V value) {
   if (hasKey(key)) removeByKey(key);
   pairs.add(new Pair<>(key, value));
   return this;
 }