Created
March 22, 2012 09:01
-
-
Save tobyweston/2157239 to your computer and use it in GitHub Desktop.
mapping widget - a little bit of yuk
This file contains 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
public static class ButtWipe { | |
public static <K, V> MapBuilder<K, V> map(K key, V value) { | |
return new MapBuilder<K, V>().map(key, value); | |
} | |
public static class MapBuilder<K, V> extends HashMap<K, V> { | |
private MapBuilder() { | |
} | |
public MapBuilder<K, V> map(K key, V value) { | |
put(key, value); | |
return this; | |
} | |
} | |
public void example() { | |
Map<String, Integer> example = map("hello", 1).map("world", 2).map("!", 3); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment