How can I initialize a HashMap with some pre-defined entries? In this article I’ll show you how you create a HashMap with values. Java doesn’t provide a method like Array.asList(). For initializing a map you have to implement something like that: [code] //Old fashion way Map<Integer, String> oldFashion = new HashMap<Integer, String>() {{ put(1, "one"); put(2, "two"); }}; …