Last active
May 16, 2020 15:53
-
-
Save NoNews/60d855d115414abfd8e93542edf7ad95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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