SI-8154 AnyRefMap iterates its way to ((null, null))

Changed logic to prevent mutation between hasNext and next from delivering invalid results.

Also fixed superscripts in scaladoc.
Merge pull request #3371 from Ichoran/issue/8154

 AnyRefMap iterates its way to ((null, null))