src/main/java/org/tenidwa/collections/utils/AugmentedMap.java
private static <K, V> ImmutableMap<K, V> createDelegate(
        final Map<K, V> base,
        final Set<? extends K> keys,
        final Function<K, V> augmentation
    ) {
        final ImmutableMap.Builder<K, V> builder = ImmutableMap.builder();
        builder.putAll(base);
        keys.stream()
            .filter(key -> !base.containsKey(key))
            .forEach(key -> builder.put(key, augmentation.apply(key)));
        return builder.build();
    }
private static <K, V> ImmutableMap<K, V> createDelegate(
        final Map<K, V> base,
        final Set<? extends K> keys,
        final Function<K, V> augmentation
    ) {
        final ImmutableMap.Builder<K, V> builder = ImmutableMap.builder();
        builder.putAll(base);
        keys.stream()
            .filter(key -> !base.containsKey(key))
            .forEach(key -> builder.put(key, augmentation.apply(key)));
        return builder.build();
    }
private static < K , V > ImmutableMap < K , V > createDelegate ( final Map < K , V > base , final Set < ? extends K > keys , final Function < K , V > augmentation ) { final ImmutableMap . Builder < K , V > builder = ImmutableMap . builder ( ) ; builder . putAll ( base ) ; keys . stream ( ) . filter ( key -> ! base . containsKey ( key ) ) . forEach ( key -> builder . put ( key , augmentation . apply ( key ) ) ) ; return builder . build ( ) ; }
Creates map delegate.
@param base Base map to augment.
@param keys Keys to the augmented map.
@param augmentation Function used to generate the new values.
@param <K> Key
@param <V> Value
@return A copy of the {@code base} map augmented with new values.
Creates map delegate .