Changeset 11395 in josm
- Timestamp:
- 2016-12-14T04:45:14+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Storage.java
r11392 r11395 504 504 } 505 505 506 private final class SafeReadonlyIter implements Iterator<T> { 507 private final T[] data; 508 private int slot; 509 510 SafeReadonlyIter(T[] data) { 511 this.data = data; 512 } 506 private abstract class AbstractIter implements Iterator<T> { 507 protected int slot; 513 508 514 509 @Override … … 519 514 } 520 515 516 protected void align() { 517 while (slot < data.length && data[slot] == null) { 518 slot++; 519 } 520 } 521 } 522 523 private final class SafeReadonlyIter extends AbstractIter { 524 private final T[] data; 525 526 SafeReadonlyIter(T[] data) { 527 this.data = data; 528 } 529 521 530 @Override 522 531 public T next() { … … 529 538 throw new UnsupportedOperationException(); 530 539 } 531 532 private void align() { 533 while (slot < data.length && data[slot] == null) { 534 slot++; 535 } 536 } 537 } 538 539 private final class Iter implements Iterator<T> { 540 } 541 542 private final class Iter extends AbstractIter { 540 543 private final int mods; 541 private int slot;542 544 private int removeSlot = -1; 543 545 544 546 Iter() { 545 547 mods = modCount; 546 }547 548 @Override549 public boolean hasNext() {550 if (data == null) return false;551 align();552 return slot < data.length;553 548 } 554 549 … … 569 564 } 570 565 571 private void align() { 566 @Override 567 protected void align() { 572 568 if (mods != modCount) 573 569 throw new ConcurrentModificationException(); 574 while (slot < data.length && data[slot] == null) { 575 slot++; 576 } 577 } 578 } 579 570 super.align(); 571 } 572 } 580 573 }
Note:
See TracChangeset
for help on using the changeset viewer.