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

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

Go to download

a-base is a library of basic (hence the name) classes, most notably immutable collection classes with copy-on-write operations

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

import com.ajjpj.abase.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