Can we get the values from a hashmap in the same sequence in which we have entered the values in hashmap? We cannot use key for storing the sequence info.
I have come across the same requirement at times, and as far as I know it is not possible.
When I need this functionality very badly, I maint two collections. One in a Map and another in a list. When I need sequential access, I use the list, and when I need high speed access by key, I use the map.
Of course, one has to make sure that both collections are always sycn'ed.
I don't know whether this is the best approach, but it works for me.
HTH, Abhik.
Ernest Friedman-Hill
,
author and iconoclast
staff