com.ajjpj.afoundation.collection.immutable.AMapWithDefault Maven / Gradle / Ivy
package com.ajjpj.afoundation.collection.immutable;
import com.ajjpj.afoundation.function.AFunction1;
/**
* @author arno
*/
class AMapWithDefault extends AWrappedMap {
private final AFunction1 super K, ? extends V, ? extends RuntimeException> defaultFunction;
AMapWithDefault(AMap inner, AFunction1 super K, ? extends V, ? extends RuntimeException> defaultFunction) {
super(inner);
this.defaultFunction = defaultFunction;
}
@Override AMap wrap(AMap inner) {
return new AMapWithDefault<>(inner, defaultFunction);
}
@Override V defaultValue(K key) {
return defaultFunction.apply(key);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy