All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ajjpj.afoundation.collection.immutable.AMapWithDefault Maven / Gradle / Ivy

There is a newer version: 1.0-pre19
Show newest version
package com.ajjpj.afoundation.collection.immutable;

import com.ajjpj.afoundation.function.AFunction1;


/**
 * @author arno
 */
class AMapWithDefault extends AWrappedMap {
    private final AFunction1 defaultFunction;

    AMapWithDefault(AMap inner, AFunction1 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