com.ajjpj.abase.collection.immutable.AMapWithDefaultValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of a-base Show documentation
Show all versions of a-base Show documentation
a-base is a library of basic (hence the name) classes, most notably immutable collection classes with copy-on-write operations
package com.ajjpj.abase.collection.immutable;
/**
* @author arno
*/
class AMapWithDefaultValue extends AWrappedMap {
private final V defaultValue;
AMapWithDefaultValue(AMap inner, V defaultValue) {
super(inner);
this.defaultValue = defaultValue;
}
@Override AMap wrap(AMap inner) {
return new AMapWithDefaultValue<>(inner, defaultValue);
}
@Override V defaultValue(K key) {
return defaultValue;
}
}