Java - get index of key in HashMap?
Posted
by llm
on Stack Overflow
See other posts from Stack Overflow
or by llm
Published on 2010-04-21T19:49:11Z
Indexed on
2010/04/21
19:53 UTC
Read the original article
Hit count: 222
In java if I am looping over the keySet()
of a HashMap
, how do I (inside the loop), get the numerical index of that key?
Basically, as I loop through the map, I want to be able to get 0,1,2...I figure this would be cleaner than declaring an int and incrementing with each iteration.
Thanks.
© Stack Overflow or respective owner