Skip to content

Instantly share code, notes, and snippets.

@tremaineeto
Created April 15, 2021 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tremaineeto/de014c18824bf3e8e12361698f365c1d to your computer and use it in GitHub Desktop.
Save tremaineeto/de014c18824bf3e8e12361698f365c1d to your computer and use it in GitHub Desktop.
HashMap<String, Integer> hm = new HashMap<>();
hm.add("a", 1);
hm.add("b", 2);
hm.add("c", 3);
hm.add("d", 4);
int b = hm.getOrDefault("b", 99);
int e = hm.getOrDefault("e", 99);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment