If Map intended for such purposes, why does it seem strange to you? I know this simple mapping and using Map can seem really bombastic for a simple task such as getting the index of a given row.
But think about it, approach 1 behaves like a Map<Integer,String> , where you search by value and get its associated key so that you can stick with the opposite Map<String,Integer> , unless you are limited to using Vector .
I am just afraid that this is one of those cases when someone takes the discussion of "performance versus memory" at the nanoscale.
source share