a-foundation/src/main/java/com/ajjpj/afoundation/collection/immutable/AHashMap.java
public static <K,V, E extends Throwable> AHashMap<K,V> fromKeysAndFunction(AEquality equality, Iterable<K> keys, AFunction1<? super K, ? extends V, E> f) throws E {
        final Iterator<K> ki = keys.iterator();

        AHashMap<K,V> result = AHashMap.empty(equality);

        while(ki.hasNext()) {
            final K key = ki.next();
            final V value = f.apply(key);

            result = result.updated(key, value);
        }
        return result;
    }
public static <K,V, E extends Throwable> AHashMap<K,V> fromKeysAndFunction(AEquality equality, Iterable<K> keys, AFunction1<? super K, ? extends V, E> f) throws E {
        final Iterator<K> ki = keys.iterator();

        AHashMap<K,V> result = AHashMap.empty(equality);

        while(ki.hasNext()) {
            final K key = ki.next();
            final V value = f.apply(key);

            result = result.updated(key, value);
        }
        return result;
    }
public static < K , V , E extends Throwable > AHashMap < K , V > fromKeysAndFunction ( AEquality equality , Iterable < K > keys , AFunction1 < ? super K , ? extends V , E > f ) throws E { final Iterator < K > ki = keys . iterator ( ) ; AHashMap < K , V > result = AHashMap . empty ( equality ) ; while ( ki . hasNext ( ) ) { final K key = ki . next ( ) ; final V value = f . apply ( key ) ; result = result . updated ( key , value ) ; } return result ; }
Returns an AHashMap instance with a given equalityForEquals, initializing it from a collection of
keys and a function. For each element of the <code>keys</code> collection, the function is called once to
determine the corresponding value, and the pair is then stored in the map.
Returns an AHashMap instance with a given equalityForEquals initializing it from a collection of keys and a function . For each element of the <code > keys< / code > collection the function is called once to determine the corresponding value and the pair is then stored in the map .