Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
private void exercise4() {
Map<String, Integer> map = new TreeMap<>();
map.put("c", 3);
map.put("b", 2);
map.put("a", 1);
StringBuilder result = new StringBuilder();
map.entrySet()
.forEach(entry ->
result.append(entry.getKey())
.append(entry.getValue()));
System.out.println(result.toString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment