in.ashwanthkumar.utils.collections.Maps Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of my-java-utils Show documentation
Show all versions of my-java-utils Show documentation
My personal set of utils that I take along with my java projects.
package in.ashwanthkumar.utils.collections;
import java.util.HashMap;
import java.util.Map;
public class Maps {
public static Map of(K key, V value) {
HashMap map = new HashMap();
map.put(key, value);
return map;
}
public static class MapBuilder {
private Map internalMap = new HashMap();
private MapBuilder() {}
public MapBuilder put(K key, V value) {
internalMap.put(key, value);
return this;
}
public Map value() {
return internalMap;
}
}
public static MapBuilder builder() {
return new MapBuilder();
}
}