Index: trunk/src/org/openstreetmap/josm/data/osm/Storage.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Storage.java	(revision 11391)
+++ trunk/src/org/openstreetmap/josm/data/osm/Storage.java	(revision 11392)
@@ -3,4 +3,5 @@
 
 import java.util.AbstractSet;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.ConcurrentModificationException;
@@ -239,8 +240,21 @@
     public synchronized int hashCode() {
         int h = 0;
-        for (T t : this) {
-            h += hash.getHashCode(t);
+        if (hash != null) {
+            for (T t : this) {
+                h += hash.getHashCode(t);
+            }
         }
         return h;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null || getClass() != obj.getClass())
+            return false;
+        Storage<?> other = (Storage<?>) obj;
+        return Arrays.equals(data, other.data)
+                && hashCode() == obj.hashCode();
     }
 
@@ -321,5 +335,5 @@
         int hcode = rehash(ha.getHashCode(key));
         int bucket = hcode & mask;
-        while ((entry = data[bucket]) != null) {
+        while (bucket < data.length && (entry = data[bucket]) != null) {
             if (ha.equals(key, entry))
                 return bucket;
@@ -500,4 +514,5 @@
         @Override
         public boolean hasNext() {
+            if (data == null) return false;
             align();
             return slot < data.length;
@@ -533,4 +548,5 @@
         @Override
         public boolean hasNext() {
+            if (data == null) return false;
             align();
             return slot < data.length;
Index: trunk/test/unit/org/openstreetmap/josm/data/osm/StorageTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/osm/StorageTest.java	(revision 11391)
+++ trunk/test/unit/org/openstreetmap/josm/data/osm/StorageTest.java	(revision 11392)
@@ -2,5 +2,4 @@
 package org.openstreetmap.josm.data.osm;
 
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
@@ -9,4 +8,5 @@
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import nl.jqno.equalsverifier.EqualsVerifier;
+import nl.jqno.equalsverifier.Warning;
 
 /**
@@ -26,11 +26,8 @@
      */
     @Test
-    @Ignore("not ready")
     public void testEqualsContract() {
         EqualsVerifier.forClass(Storage.class).usingGetClass()
-            /*.withPrefabValues(Collection.class, new HashSet<>(Arrays.asList(1)), new HashSet<>(Arrays.asList(2)))
-            .withPrefabValues(AbstractCollection.class, new HashSet<>(Arrays.asList(1)), new HashSet<>(Arrays.asList(2)))
-            .withPrefabValues(Set.class, new HashSet<>(Arrays.asList(1)), new HashSet<>(Arrays.asList(2)))
-            .withPrefabValues(AbstractSet.class, new HashSet<>(Arrays.asList(1)), new HashSet<>(Arrays.asList(2)))*/
+            .suppress(Warning.NONFINAL_FIELDS)
+            .withIgnoredFields("arrayCopyNecessary", "hash", "mask", "modCount", "safeIterator", "size")
             .withPrefabValues(Hash.class, Storage.<Integer>defaultHash(), Storage.<Boolean>defaultHash())
             .verify();
