public static void main(String[] args) { Map<String, String> map = map(_("A", "a"), _("B", "b")); System.err.println(map); } private static <K, V> Map<K, V> map(Map.Entry<K, V>... entries) { Map<K, V> map = new HashMap<K, V>(); for (Map.Entry<K, V> e : entries) map.put(e.getKey(), e.getValue()); return map; } private static <K, V> Map.Entry<K, V> _(final K key, final V value) { return new Map.Entry<K, V>() { private K _key = key; private V _value = value; public K getKey() { return _key; } public V getValue() { return _value; } public V setValue(V value) { _value = value; return value; } }; }