MCPcopy Create free account
hub / github.com/davidgiven/luje / HashEnumIterator

Class HashEnumIterator

lib/java/util/Hashtable.java:637–713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

635 }
636
637 class HashEnumIterator<E> extends HashIterator<E> implements Enumeration<E> {
638
639 private boolean isEnumeration = false;
640
641 int start;
642
643 Entry<K, V> entry;
644
645 HashEnumIterator(MapEntry.Type<E, K, V> value) {
646 super(value);
647 }
648
649 HashEnumIterator(MapEntry.Type<E, K, V> value, boolean isEnumeration) {
650 super(value);
651 this.isEnumeration = isEnumeration;
652 start = lastSlot + 1;
653 }
654
655 public boolean hasMoreElements() {
656 if (isEnumeration) {
657 if (entry != null) {
658 return true;
659 }
660 while (start > firstSlot) {
661 if (elementData[--start] != null) {
662 entry = elementData[start];
663 return true;
664 }
665 }
666 return false;
667 }
668 // iterator
669 return super.hasNext();
670 }
671
672 public boolean hasNext() {
673 if (isEnumeration) {
674 return hasMoreElements();
675 }
676 // iterator
677 return super.hasNext();
678 }
679
680 public E next() {
681 if (isEnumeration) {
682 if (expectedModCount == modCount) {
683 return nextElement();
684 } else {
685 throw new ConcurrentModificationException();
686 }
687 }
688 // iterator
689 return super.next();
690 }
691
692 @SuppressWarnings("unchecked")
693 public E nextElement() {
694 if (isEnumeration) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected