Modify containsKey to return index of key instead of boolean.