Package private AbstractEmptyIterator implements ResettableIterator so
subclasses don't
This commit is contained in:
parent
daad236c89
commit
d9d6f2098a
|
@ -24,7 +24,8 @@
|
|||
<body>
|
||||
<release version="4.5.0-M3" date="YYYY-MM-DD" description="This is a feature and maintenance release. Java 8 or later is required.">
|
||||
<!-- FIX -->
|
||||
<action issue="COLLECTIONS-857" type="fix" dev="ggregory" due-to="Claude Warren">Complete bloom filter documentation #507.</action>
|
||||
<action issue="COLLECTIONS-857" type="fix" dev="ggregory" due-to="Claude Warren">Complete bloom filter documentation #507.</action>
|
||||
<action type="fix" dev="ggregory" due-to="Gary Gregory">Package private AbstractEmptyIterator implements ResettableIterator so subclasses don't.</action>
|
||||
<!-- ADD -->
|
||||
<!-- UPDATE -->
|
||||
</release>
|
||||
|
|
|
@ -18,12 +18,14 @@ package org.apache.commons.collections4.iterators;
|
|||
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.apache.commons.collections4.ResettableIterator;
|
||||
|
||||
/**
|
||||
* Provides an implementation of an empty iterator.
|
||||
* Provides an abstract implementation of an empty iterator.
|
||||
*
|
||||
* @since 3.1
|
||||
*/
|
||||
abstract class AbstractEmptyIterator<E> {
|
||||
abstract class AbstractEmptyIterator<E> implements ResettableIterator<E> {
|
||||
|
||||
/**
|
||||
* Constructs a new instance.
|
||||
|
@ -35,6 +37,7 @@ abstract class AbstractEmptyIterator<E> {
|
|||
throw new UnsupportedOperationException("add() not supported for empty Iterator");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return false;
|
||||
}
|
||||
|
@ -43,6 +46,7 @@ abstract class AbstractEmptyIterator<E> {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public E next() {
|
||||
throw new NoSuchElementException("Iterator contains no elements");
|
||||
}
|
||||
|
@ -59,10 +63,12 @@ abstract class AbstractEmptyIterator<E> {
|
|||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new IllegalStateException("Iterator contains no elements");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
// do nothing
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.commons.collections4.ResettableIterator;
|
|||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 2.1.1 and 3.1
|
||||
*/
|
||||
public class EmptyIterator<E> extends AbstractEmptyIterator<E> implements ResettableIterator<E> {
|
||||
public class EmptyIterator<E> extends AbstractEmptyIterator<E> {
|
||||
|
||||
/**
|
||||
* Singleton instance of the iterator.
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.apache.commons.collections4.iterators;
|
||||
|
||||
import org.apache.commons.collections4.MapIterator;
|
||||
import org.apache.commons.collections4.ResettableIterator;
|
||||
|
||||
/**
|
||||
* Provides an implementation of an empty map iterator.
|
||||
|
@ -27,7 +26,7 @@ import org.apache.commons.collections4.ResettableIterator;
|
|||
* @since 3.1
|
||||
*/
|
||||
public class EmptyMapIterator<K, V> extends AbstractEmptyMapIterator<K, V> implements
|
||||
MapIterator<K, V>, ResettableIterator<K> {
|
||||
MapIterator<K, V> {
|
||||
|
||||
/**
|
||||
* Singleton instance of the iterator.
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.apache.commons.collections4.iterators;
|
||||
|
||||
import org.apache.commons.collections4.OrderedIterator;
|
||||
import org.apache.commons.collections4.ResettableIterator;
|
||||
|
||||
/**
|
||||
* Provides an implementation of an empty ordered iterator.
|
||||
|
@ -26,7 +25,7 @@ import org.apache.commons.collections4.ResettableIterator;
|
|||
* @since 3.1
|
||||
*/
|
||||
public class EmptyOrderedIterator<E> extends AbstractEmptyIterator<E>
|
||||
implements OrderedIterator<E>, ResettableIterator<E> {
|
||||
implements OrderedIterator<E> {
|
||||
|
||||
/**
|
||||
* Singleton instance of the iterator.
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.apache.commons.collections4.iterators;
|
||||
|
||||
import org.apache.commons.collections4.OrderedMapIterator;
|
||||
import org.apache.commons.collections4.ResettableIterator;
|
||||
|
||||
/**
|
||||
* Provides an implementation of an empty ordered map iterator.
|
||||
|
@ -27,7 +26,7 @@ import org.apache.commons.collections4.ResettableIterator;
|
|||
* @since 3.1
|
||||
*/
|
||||
public class EmptyOrderedMapIterator<K, V> extends AbstractEmptyMapIterator<K, V>
|
||||
implements OrderedMapIterator<K, V>, ResettableIterator<K> {
|
||||
implements OrderedMapIterator<K, V> {
|
||||
|
||||
/**
|
||||
* Singleton instance of the iterator.
|
||||
|
|
Loading…
Reference in New Issue