Change responsibility of handling null key in HashMap.

This in preparation for upcoming WASM specialization of the HashMaps.

PiperOrigin-RevId: 355495398
Change-Id: Idac44e92f567d7e854cf85088104039eec0c344e
diff --git a/user/super/com/google/gwt/emul/java/util/HashMap.java b/user/super/com/google/gwt/emul/java/util/HashMap.java
index 2d27ead..aba3a41 100644
--- a/user/super/com/google/gwt/emul/java/util/HashMap.java
+++ b/user/super/com/google/gwt/emul/java/util/HashMap.java
@@ -70,6 +70,9 @@
 
   @Override
   int getHashCode(Object key) {
+    if (key == null) {
+      return 0;
+    }
     int hashCode = key.hashCode();
     // Coerce to int -- our classes all do this, but a user-written class might not.
     return ensureInt(hashCode);
diff --git a/user/super/com/google/gwt/emul/java/util/InternalHashCodeMap.java b/user/super/com/google/gwt/emul/java/util/InternalHashCodeMap.java
index 05aca05..ab96835 100644
--- a/user/super/com/google/gwt/emul/java/util/InternalHashCodeMap.java
+++ b/user/super/com/google/gwt/emul/java/util/InternalHashCodeMap.java
@@ -19,7 +19,6 @@
 
 import java.util.AbstractMap.SimpleEntry;
 import java.util.Map.Entry;
-
 import javaemul.internal.ArrayHelper;
 import javaemul.internal.JsUtils;
 import javaemul.internal.NativeArray;
@@ -157,6 +156,6 @@
    * also handles null keys as well.
    */
   private int hash(Object key) {
-    return key == null ? 0 : host.getHashCode(key);
+    return host.getHashCode(key);
   }
 }