DEV Community

Discussion on: Data Structures: Bidirectional Map

 
dean profile image
dean

I think the confusion comes from how errors occur - errors do not simply happen randomly, they happen for reasons. A map update should never result in an error occurring, maybe except some kind of fatal error like an out-of-memory error, in which case the program will not be able to work properly anyway.

Updating a map is (pretty much) as safe as creating an array - we don’t need, or want, to error check it.