I'm pretty sure the map here is not the important part. The example demonstrates how to use the rest interface to talk with a store. The actual implementation of the store is up to you.
Absolutely! Example code affects programming style and teaches people. It should be correct (and in good style), this is probably very much underrated.
Using an unprotected map here is incorrect.