shyam sunder prasad wrote:my condition is you should not use LinkedHashMap ok.
i want method to retrieve in order as i inserted.
Then that's exactly what a
LinkedHashMap does, as has been pointed out. Why don't you want to use that?
In a plain
HashMap, the information simply doesn't exist any more once they've been added. So your only options would be to extend and modify
HashMap (in other words, write your own
LinkedHashMap), or keep a separate list of the items you've added so you can control the order of iteration.