Even more readable code without if-else
blog.frankel.ch
blog.frankel.ch
Java enum classes work well for enumerating those, so I end up creating those. These work great so if I use the enum in an if-else sequence the compiler knows if I covered all possible values.
For mappings I instead add a constructor to my enum class so that I can setup the mapping as an instance variable.