3 ms·
Keys do not need to be strings in Java either, you need to properly implement equals and hashCode() methods though for the key type. Also Java has like ten dif
by voidfunc 4y ago
Keys do not need to be strings in Java either, you need to properly implement equals and hashCode() methods though for the key type.
Also Java has like ten different implementations of Map<K,V> depending on various use cases.
- thayne 4y agoI wasn't comparing to Java. I was commenting on > Javascript: Object And in javascript, if you use an Object as a map, the keys do have to be strings (if they aren't already, they are converted into strings).