I have a requirement that a Map will be constructed with up to 50~200 entries (it could be more, let’s call it not-too-little anyway). The writing is only done once and the reading (using Map.get(‘keyName’)) can go more than 20 per request (it’s a webapp).
I’m going for Hashmap currently as it (I suppose) gives me the most optimum performance (note: numerous reads per request). Not being a data-structure guy, can any of you suggest a Map implementation that’s best fit for my requirement, say from the java.lang.*, Apache commons, etc. packages?
yc
Unless you are actually having performance problems (and have traced them to this code) I wouldn’t worry about it.
And before I tried to replace the Map I’d look at why, exactly, I need to do 4000 lookups (200 entries by 20 reads each) to generate a web page.
But at a bet I’d guess that the time to do those 4000 lookups will turn out to be negligible compared to other parts of the process.