3 ms·
Riddle me this, how would a Map be implemented if Null was stripped from Java? map.getOrThrow(key) map.getOrDefault(key, defaultValue)
by orangecat 10y ago
Riddle me this, how would a Map be implemented if Null was stripped from Java?
map.getOrThrow(key)
map.getOrDefault(key, defaultValue)
- gravypod 10y agoSo I can either throw an exception and take a speed hit in my performance critical code or I can remove a possible value from my map?
- devishard 10y agoIt's not "removing a possible value from your map", it's having your type system explicitly check that you're handling the edge case at compile time. This works in practice in a wide variety of languages.