- Timestamp:
- 2016-12-14T00:52:36+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Storage.java
r11342 r11392 3 3 4 4 import java.util.AbstractSet; 5 import java.util.Arrays; 5 6 import java.util.Collection; 6 7 import java.util.ConcurrentModificationException; … … 239 240 public synchronized int hashCode() { 240 241 int h = 0; 241 for (T t : this) { 242 h += hash.getHashCode(t); 242 if (hash != null) { 243 for (T t : this) { 244 h += hash.getHashCode(t); 245 } 243 246 } 244 247 return h; 248 } 249 250 @Override 251 public boolean equals(Object obj) { 252 if (this == obj) 253 return true; 254 if (obj == null || getClass() != obj.getClass()) 255 return false; 256 Storage<?> other = (Storage<?>) obj; 257 return Arrays.equals(data, other.data) 258 && hashCode() == obj.hashCode(); 245 259 } 246 260 … … 321 335 int hcode = rehash(ha.getHashCode(key)); 322 336 int bucket = hcode & mask; 323 while ((entry = data[bucket]) != null) { 337 while (bucket < data.length && (entry = data[bucket]) != null) { 324 338 if (ha.equals(key, entry)) 325 339 return bucket; … … 500 514 @Override 501 515 public boolean hasNext() { 516 if (data == null) return false; 502 517 align(); 503 518 return slot < data.length; … … 533 548 @Override 534 549 public boolean hasNext() { 550 if (data == null) return false; 535 551 align(); 536 552 return slot < data.length;
Note:
See TracChangeset
for help on using the changeset viewer.