com.aol.micro.server.utility.HashMapBuilder Maven / Gradle / Ivy
package com.aol.micro.server.utility;
import java.util.HashMap;
import java.util.Map;
public class HashMapBuilder {
public static Builder from(Map map) {
return new Builder(map);
}
public static Builder of(K key, V value) {
return new Builder(key, value);
}
public static Builder of(K key, V value,K key1, V value1) {
return new Builder(key, value).put(key1, value1);
}
public static Builder of(K key, V value,K key1, V value1,K key2, V value2) {
return new Builder(key, value).put(key, value, key1, value1, key2, value2);
}
public static Builder of(K key, V value,K key1, V value1,K key2, V value2,K key3, V value3) {
return new Builder(key, value).put(key, value, key1, value1, key2, value2,key3, value3);
}
public static final class Builder {
private final Map build;
public Builder(K key, V value) {
build = new HashMap();
build.put(key, value);
}
public Builder(Map map) {
build = new HashMap(map);
}
public Builder putAll(Map map){
build.putAll(map);
return this;
}
public Builder put(K key, V value) {
build.put(key, value);
return this;
}
public Builder put(K key, V value,K key1, V value1) {
build.put(key, value);
build.put(key1, value1);
return this;
}
public Builder put(K key, V value,K key1, V value1,K key2, V value2) {
build.put(key, value);
build.put(key1, value1);
build.put(key2, value2);
return this;
}
public Builder put(K key, V value,K key1, V value1,K key2, V value2,K key3, V value3) {
build.put(key, value);
build.put(key1, value1);
build.put(key2, value2);
build.put(key3, value3);
return this;
}
public Map build() {
return build;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy