Created
November 17, 2018 20:31
-
-
Save kijanowski/0641b69a8008f074d4de4f60f42a4aa9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// instead of | |
private static final java.util.Map<Integer, String> myMap = new java.util.HashMap<>(); | |
static { | |
myMap.put(1, "one"); | |
myMap.put(2, "two"); | |
} | |
// or | |
private static final java.util.Map<Integer, String> myJava9Map = java.util.Map.of( | |
1, "one", | |
2, "two" | |
); | |
// do it the functional way | |
private static final io.vavr.collection.Map<Integer, String> myVavrMap = io.vavr.collection.HashMap.of( | |
1, "one", | |
2, "two" | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment