Skip to content

Instantly share code, notes, and snippets.

@chetkhatri
Created August 11, 2017 02:02
Show Gist options
  • Select an option

  • Save chetkhatri/3ba562b7d217d0ee0d7a8fa61bea48c7 to your computer and use it in GitHub Desktop.

Select an option

Save chetkhatri/3ba562b7d217d0ee0d7a8fa61bea48c7 to your computer and use it in GitHub Desktop.
that depends on you use case, but a Map[Key, List[Value]] could work if you need key lookup
a more typesafe alternative would be a Map[Key, NonEmptyList[Value]], but you'd have to get the NonEmptyList from somewhere else
the simplest would be just something like a List[(Key, Value)]
you could also look in to a Vector[(Key, Value)] sorted by key so you can binary search on it and such
Options aplenty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment