
aQute.libg.map.BuilderMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of biz.aQute.bndlib Show documentation
Show all versions of biz.aQute.bndlib Show documentation
bndlib: A Swiss Army Knife for OSGi
The newest version!
package aQute.libg.map;
import java.util.HashMap;
import java.util.Map;
/**
* A map that is to set inline like a builder. I.e. you can do `new
* LiteralMap<>().set("a", a).set("b",b)`.
*
* @param the key type
* @param the value type
*/
public class BuilderMap extends HashMap {
private static final long serialVersionUID = 1L;
public BuilderMap set(K key, V value) {
put(key, value);
return this;
}
public BuilderMap setAll(Map src) {
putAll(src);
return this;
}
public BuilderMap setIfAbsent(K key, V value) {
putIfAbsent(key, value);
return this;
}
public static BuilderMap map(K key, V value) {
return new BuilderMap().set(key, value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy