Skip to content

Instantly share code, notes, and snippets.

@gaplo917
Last active December 7, 2016 15:45
Show Gist options
  • Save gaplo917/d302fd3e64082560e92af5d58dd246b7 to your computer and use it in GitHub Desktop.
Save gaplo917/d302fd3e64082560e92af5d58dd246b7 to your computer and use it in GitHub Desktop.
Java has no Type Inference that makes code become verbose
// Java 9
final Map<String,Integer> abc = Map.of("a",1, "b", 2, "c", 3);
// Java >= 5
final Map<String,Integer> abc = new HashMap<String, Integer>() {{
put("a",1);
put("b",2);
put("c",3);
}};
final Integer c = abc.get("c");
// Question:
// If you are asked to refactor from Map<String,Integer> to Map<String,String>,
// try to estimate the efforts!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment