public Map<K, V> valueFilter($.Function<V, Boolean> predicate) { java.util.Map<K, V> map = new HashMap<>(); for (java.util.Map.Entry<K, V> entry : entrySet()) { V v = entry.getValue(); if (predicate.apply(v)) { map.put(entry.getKey(), v); } } Map<K, V> filtered = new Map<>(isReadOnly(), map); return filtered; }
public Map<K, V> valueFilter($.Function<V, Boolean> predicate) { java.util.Map<K, V> map = new HashMap<>(); for (java.util.Map.Entry<K, V> entry : entrySet()) { V v = entry.getValue(); if (predicate.apply(v)) { map.put(entry.getKey(), v); } } Map<K, V> filtered = new Map<>(isReadOnly(), map); return filtered; }
public Map<K, V> filter($.Function<K, Boolean> predicate) { java.util.Map<K, V> map = new HashMap<>(); for (java.util.Map.Entry<K, V> entry : entrySet()) { K k = entry.getKey(); if (predicate.apply(k)) { map.put(k, entry.getValue()); } } Map<K, V> filtered = new Map<>(isReadOnly(), map); return filtered; }
/** * Loop through this map on each key/value pair, apply them to the function specified * @param indexedVisitor the function that takes argument of (key, value) pair * @return this map */ public Map<K, V> forEach(IndexedVisitor<? super K, ? super V> indexedVisitor) { for (java.util.Map.Entry<K, V> entry: entrySet()) { try { indexedVisitor.apply(entry.getKey(), entry.getValue()); } catch (NotAppliedException e) { // ignore } } return this; }
/** * Loop through this map on each key/value pair, apply them to the function specified * @param indexedVisitor the function that takes argument of (key, value) pair * @return this map */ public Map<K, V> forEach(IndexedVisitor<? super K, ? super V> indexedVisitor) { for (java.util.Map.Entry<K, V> entry: entrySet()) { try { indexedVisitor.apply(entry.getKey(), entry.getValue()); } catch (NotAppliedException e) { // ignore } } return this; }
public <NK, NV> Map<NK, NV> transform($.Function<K, NK> keyTransformer, $.Function<V, NV> valueTransformer) { Map<NK, NV> newMap = C.newMap(); for (java.util.Map.Entry<K, V> entry : entrySet()) { newMap.put(keyTransformer.apply(entry.getKey()), valueTransformer.apply(entry.getValue())); } return newMap; }
public Map<K, V> filter($.Function<K, Boolean> predicate) { java.util.Map<K, V> map = new HashMap<>(); for (java.util.Map.Entry<K, V> entry : entrySet()) { K k = entry.getKey(); if (predicate.apply(k)) { map.put(k, entry.getValue()); } } Map<K, V> filtered = new Map<>(isReadOnly(), map); return filtered; }
public Map<V, K> flipped() { Map<V, K> flip = C.newMap(); for (java.util.Map.Entry<K, V> entry : entrySet()) { flip.put(entry.getValue(), entry.getKey()); } return flip; }
public <NK, NV> Map<NK, NV> transform($.Function<K, NK> keyTransformer, $.Function<V, NV> valueTransformer) { Map<NK, NV> newMap = C.newMap(); for (java.util.Map.Entry<K, V> entry : entrySet()) { newMap.put(keyTransformer.apply(entry.getKey()), valueTransformer.apply(entry.getValue())); } return newMap; }
public <NK> Map<NK, V> transformKeys($.Function<K, NK> keyTransformer) { Map<NK, V> newMap = C.newMap(); for (java.util.Map.Entry<K, V> entry : entrySet()) { newMap.put(keyTransformer.apply(entry.getKey()), entry.getValue()); } return newMap; }
public Map<V, K> flipped() { Map<V, K> flip = C.newMap(); for (java.util.Map.Entry<K, V> entry : entrySet()) { flip.put(entry.getValue(), entry.getKey()); } return flip; }
public <NK> Map<NK, V> transformKeys($.Function<K, NK> keyTransformer) { Map<NK, V> newMap = C.newMap(); for (java.util.Map.Entry<K, V> entry : entrySet()) { newMap.put(keyTransformer.apply(entry.getKey()), entry.getValue()); } return newMap; }
public Set<$.Binary<K, V>> zip() { C.Set<$.Binary<K, V>> zipped = C.newSet(); for (java.util.Map.Entry<K, V> entry : entrySet()) { zipped.add($.T2(entry.getKey(), entry.getValue())); } return zipped; }
public <NV> Map<K, NV> transformValues($.Function<V, NV> valueTransformer) { Map<K, NV> newMap = C.newMap(); for (java.util.Map.Entry<K, V> entry : entrySet()) { newMap.put(entry.getKey(), valueTransformer.apply(entry.getValue())); } return newMap; }
public Set<$.Binary<K, V>> zip() { C.Set<$.Binary<K, V>> zipped = C.newSet(); for (java.util.Map.Entry<K, V> entry : entrySet()) { zipped.add($.T2(entry.getKey(), entry.getValue())); } return zipped; }
public <NV> Map<K, NV> transformValues($.Function<V, NV> valueTransformer) { Map<K, NV> newMap = C.newMap(); for (java.util.Map.Entry<K, V> entry : entrySet()) { newMap.put(entry.getKey(), valueTransformer.apply(entry.getValue())); } return newMap; }