Skip to content

Instantly share code, notes, and snippets.

@NoNews
Last active May 16, 2020 15:53
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 NoNews/60d855d115414abfd8e93542edf7ad95 to your computer and use it in GitHub Desktop.
Save NoNews/60d855d115414abfd8e93542edf7ad95 to your computer and use it in GitHub Desktop.
data class User(val id: Int, val name: String)
data class Key(val name: String) {
//bad hashCode, for demonstration
override fun hashCode() = name.length
}
val map = ArrayMap<Key, User>()
val user = User(1507, "Bojack Horseman")
val key = Key(user.name)
map[key] = user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment