Blake Miller wrote: You still have to get the valuess INTO the map, so how does that provide any gains over the switch statement? The gains are in the area of maintenance, not necessarily performance.
For large switch statements a map lookup is easier to understand and therefore easier to maintain.
A map lookup is more robust (i.e. less error-prone, dure to factoring) if the switch is needed more than once.
As you have already pointed out, a map allows run-time initialization and is therefore more flexible.
/ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com