I assigned to null as the next call can throw an NoSuchElementException, case when currentKey should become null.
But I will change it to a try block to be clear the intention.