se.culvertsoft.mgen.javapack.util.MapMaker Maven / Gradle / Ivy
package se.culvertsoft.mgen.javapack.util;
import java.util.HashMap;
/**
* Internal utility class for creating maps with contents in one line. Intended
* to be used only in generated code.
*
* @param
* The key type of the map to be made
*
* @param
* The value type of the map to be made
*/
public class MapMaker {
public MapMaker(final int n) {
m_map = new HashMap(n);
}
public MapMaker put(final K key, final V value) {
m_map.put(key, value);
return this;
}
public HashMap make() {
return m_map;
}
private final HashMap m_map;
}