Skip to content

Instantly share code, notes, and snippets.

@ch8n
Created October 12, 2020 13:20
Show Gist options
  • Save ch8n/0ddd965af180c0e0a41d96e62c40f34c to your computer and use it in GitHub Desktop.
Save ch8n/0ddd965af180c0e0a41d96e62c40f34c to your computer and use it in GitHub Desktop.
Hash map kotlin and java signature
// Kotlin signature
typealias HashMap<K, V> = HashMap<K, V>
// Java signature
class HashMap<K,V>
extends AbstractMap<K,V>
implements Map<K,V>, Cloneable, Serializable
// AbstractMap<K,V> is a skeletal implementation of the Map interface,
// Java's Map<K,V> is very close to MutableMap<K,V> than kotlin's Map<K,V>
// i.e it contains mutable opertaions internally, though use structures named
// similar to Kotlin's Map<K,V> like Map.Entry but are infact Mutable Entry
Java HashMap has three constructors
- HashMap()
- HashMap(int initialCapacity)
- HashMap(int initialCapacity,float fillRatio)
- HashMap(Map<K,V> fromMap)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment