Skip to content

Instantly share code, notes, and snippets.

@manuelGitHub1
Created October 31, 2022 21:21
Show Gist options
  • Save manuelGitHub1/0303802f3533ffff67d558fa6ff0b944 to your computer and use it in GitHub Desktop.
Save manuelGitHub1/0303802f3533ffff67d558fa6ff0b944 to your computer and use it in GitHub Desktop.
Map<String, Integer> map = new HashMap<>();
map.put("Key1", 12);
map.compute("Key1", ( key, val ) -> (val == null) ? 1 : val + 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment