| Author |
Why is this hashmap iterating through an infinite loop?
|
Patrick Noah
Greenhorn
Joined: Aug 22, 2011
Posts: 28
|
|
I am writing a method to determine whether two strings are anagrams of one another. I am trying to print out the contents of my hashmap to debug it but am encountering an infinite loop. Can someone please tell me why this is happening? Thank you.
|
 |
Alexander Sales
Ranch Hand
Joined: Feb 21, 2011
Posts: 89
|
|
Is this part reliable?
|
OCPJP 6, OCEWCD Java EE 6
|
 |
Matthew Brown
Bartender
Joined: Apr 06, 2010
Posts: 3795
|
|
|
Every time you call iterator() you get a new one, so you reset the position. So you need to keep calling next() on the same Iterator.
|
 |
 |
|
|
subject: Why is this hashmap iterating through an infinite loop?
|
|
|