Skip to content

Instantly share code, notes, and snippets.

@Arturus
Created October 26, 2015 15:25
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 Arturus/baaae17a18dbf3cf2b78 to your computer and use it in GitHub Desktop.
Save Arturus/baaae17a18dbf3cf2b78 to your computer and use it in GitHub Desktop.
Object getOrCreate(String key, Object newValue) {
Object result = map.get(key);
if (result == null) {
map.put(key, newValue);
result = newValue;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment