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.