Skip to content

Instantly share code, notes, and snippets.

@codahale
Created November 21, 2009 05:22
Show Gist options
  • Select an option

  • Save codahale/240022 to your computer and use it in GitHub Desktop.

Select an option

Save codahale/240022 to your computer and use it in GitHub Desktop.
var item = things.get(k)
if (item eq null) {
val newItem = new Item()
item = things.putIfAbsent(k, newItem)
if (item eq null) {
item = newItem
}
}
return item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment