From 9bc0e82584952052f400efccc9640bc0e68d34fb Mon Sep 17 00:00:00 2001 From: Stephen Colebourne <scolebourne@apache.org> Date: Fri, 14 Nov 2003 22:58:27 +0000 Subject: [PATCH] Rename ResetableIterator to ResettableIterator Remove Map and Ordered variants to avoid too many classes git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131341 13f79535-47bb-0310-9956-ffa450edef68 --- .../collections/AbstractDualBidiMap.java | 8 +- .../apache/commons/collections/Flat3Map.java | 8 +- .../commons/collections/IteratorUtils.java | 101 ++++++++++-------- .../collections/iterators/ArrayIterator.java | 6 +- .../iterators/ArrayListIterator.java | 6 +- .../iterators/EntrySetMapIterator.java | 6 +- .../iterators/LoopingIterator.java | 6 +- .../iterators/ObjectArrayIterator.java | 6 +- .../iterators/ObjectArrayListIterator.java | 6 +- .../iterators/ResetableMapIterator.java | 77 ------------- .../iterators/ResetableOrderedIterator.java | 77 ------------- .../ResetableOrderedMapIterator.java | 78 -------------- ...eIterator.java => ResettableIterator.java} | 6 +- ...rator.java => ResettableListIterator.java} | 6 +- .../iterators/SingletonIterator.java | 6 +- .../iterators/SingletonListIterator.java | 6 +- .../collections/TestIteratorUtils.java | 38 +++---- .../iterators/TestSingletonIterator.java | 8 +- .../iterators/TestSingletonListIterator.java | 6 +- 19 files changed, 116 insertions(+), 345 deletions(-) delete mode 100644 src/java/org/apache/commons/collections/iterators/ResetableMapIterator.java delete mode 100644 src/java/org/apache/commons/collections/iterators/ResetableOrderedIterator.java delete mode 100644 src/java/org/apache/commons/collections/iterators/ResetableOrderedMapIterator.java rename src/java/org/apache/commons/collections/iterators/{ResetableIterator.java => ResettableIterator.java} (93%) rename src/java/org/apache/commons/collections/iterators/{ResetableListIterator.java => ResettableListIterator.java} (92%) diff --git a/src/java/org/apache/commons/collections/AbstractDualBidiMap.java b/src/java/org/apache/commons/collections/AbstractDualBidiMap.java index 1cfb74cf3..5d481bb50 100644 --- a/src/java/org/apache/commons/collections/AbstractDualBidiMap.java +++ b/src/java/org/apache/commons/collections/AbstractDualBidiMap.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/AbstractDualBidiMap.java,v 1.9 2003/11/08 18:40:17 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/AbstractDualBidiMap.java,v 1.10 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -66,7 +66,7 @@ import org.apache.commons.collections.decorators.AbstractCollectionDecorator; import org.apache.commons.collections.decorators.AbstractIteratorDecorator; import org.apache.commons.collections.decorators.AbstractMapEntryDecorator; import org.apache.commons.collections.iterators.MapIterator; -import org.apache.commons.collections.iterators.ResetableMapIterator; +import org.apache.commons.collections.iterators.ResettableIterator; /** * Abstract <code>BidiMap</code> implemented using two maps. @@ -75,7 +75,7 @@ import org.apache.commons.collections.iterators.ResetableMapIterator; * <code>createMap</code> method. * * @since Commons Collections 3.0 - * @version $Id: AbstractDualBidiMap.java,v 1.9 2003/11/08 18:40:17 scolebourne Exp $ + * @version $Id: AbstractDualBidiMap.java,v 1.10 2003/11/14 22:58:27 scolebourne Exp $ * * @author Matthew Hawthorne * @author Stephen Colebourne @@ -548,7 +548,7 @@ public abstract class AbstractDualBidiMap implements BidiMap { /** * Inner class MapIterator. */ - protected static class BidiMapIterator implements ResetableMapIterator { + protected static class BidiMapIterator implements MapIterator, ResettableIterator { protected final AbstractDualBidiMap map; protected Iterator iterator; diff --git a/src/java/org/apache/commons/collections/Flat3Map.java b/src/java/org/apache/commons/collections/Flat3Map.java index f787d732b..15ddef17a 100644 --- a/src/java/org/apache/commons/collections/Flat3Map.java +++ b/src/java/org/apache/commons/collections/Flat3Map.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/Flat3Map.java,v 1.2 2003/11/08 18:49:06 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/Flat3Map.java,v 1.3 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -68,7 +68,7 @@ import java.util.Set; import org.apache.commons.collections.iterators.EntrySetMapIterator; import org.apache.commons.collections.iterators.MapIterator; -import org.apache.commons.collections.iterators.ResetableMapIterator; +import org.apache.commons.collections.iterators.ResettableIterator; /** * A <code>Map</code> implementation that stores data in simple fields until @@ -97,7 +97,7 @@ import org.apache.commons.collections.iterators.ResetableMapIterator; * (Note that the impact of this has not actually been tested!) * * @since Commons Collections 3.0 - * @version $Revision: 1.2 $ $Date: 2003/11/08 18:49:06 $ + * @version $Revision: 1.3 $ $Date: 2003/11/14 22:58:27 $ * * @author Stephen Colebourne */ @@ -588,7 +588,7 @@ public class Flat3Map implements Map { /** * FlatMapIterator */ - static class FlatMapIterator implements ResetableMapIterator { + static class FlatMapIterator implements MapIterator, ResettableIterator { private final Flat3Map iFlatMap; private int iIndex = 0; private boolean iCanRemove = false; diff --git a/src/java/org/apache/commons/collections/IteratorUtils.java b/src/java/org/apache/commons/collections/IteratorUtils.java index e0c102a23..120e31dc7 100644 --- a/src/java/org/apache/commons/collections/IteratorUtils.java +++ b/src/java/org/apache/commons/collections/IteratorUtils.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/IteratorUtils.java,v 1.16 2003/11/08 19:26:28 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/IteratorUtils.java,v 1.17 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -83,11 +83,10 @@ import org.apache.commons.collections.iterators.LoopingIterator; import org.apache.commons.collections.iterators.MapIterator; import org.apache.commons.collections.iterators.ObjectArrayIterator; import org.apache.commons.collections.iterators.ObjectArrayListIterator; -import org.apache.commons.collections.iterators.ResetableIterator; -import org.apache.commons.collections.iterators.ResetableListIterator; -import org.apache.commons.collections.iterators.ResetableMapIterator; -import org.apache.commons.collections.iterators.ResetableOrderedIterator; -import org.apache.commons.collections.iterators.ResetableOrderedMapIterator; +import org.apache.commons.collections.iterators.OrderedIterator; +import org.apache.commons.collections.iterators.OrderedMapIterator; +import org.apache.commons.collections.iterators.ResettableIterator; +import org.apache.commons.collections.iterators.ResettableListIterator; import org.apache.commons.collections.iterators.SingletonIterator; import org.apache.commons.collections.iterators.SingletonListIterator; import org.apache.commons.collections.iterators.TransformIterator; @@ -101,7 +100,7 @@ import org.apache.commons.collections.iterators.UnmodifiableMapIterator; * {@link org.apache.commons.collections.iterators} subpackage. * * @since Commons Collections 2.1 - * @version $Revision: 1.16 $ $Date: 2003/11/08 19:26:28 $ + * @version $Revision: 1.17 $ $Date: 2003/11/14 22:58:27 $ * * @author Stephen Colebourne * @author Phil Steitz @@ -113,23 +112,23 @@ public class IteratorUtils { /** * An iterator over no elements */ - public static final ResetableIterator EMPTY_ITERATOR = new EmptyIterator(); + public static final ResettableIterator EMPTY_ITERATOR = new EmptyIterator(); /** * A list iterator over no elements */ - public static final ResetableListIterator EMPTY_LIST_ITERATOR = new EmptyListIterator(); + public static final ResettableListIterator EMPTY_LIST_ITERATOR = new EmptyListIterator(); /** * An ordered iterator over no elements */ - public static final ResetableOrderedIterator EMPTY_ORDERED_ITERATOR = new EmptyOrderedIterator(); + public static final OrderedIterator EMPTY_ORDERED_ITERATOR = new EmptyOrderedIterator(); /** * A map iterator over no elements */ - public static final ResetableMapIterator EMPTY_MAP_ITERATOR = new EmptyMapIterator(); + public static final MapIterator EMPTY_MAP_ITERATOR = new EmptyMapIterator(); /** * An ordered map iterator over no elements */ - public static final ResetableOrderedMapIterator EMPTY_ORDERED_MAP_ITERATOR = new EmptyOrderedMapIterator(); + public static final OrderedMapIterator EMPTY_ORDERED_MAP_ITERATOR = new EmptyOrderedMapIterator(); /** * Prevents instantiation. @@ -137,9 +136,8 @@ public class IteratorUtils { private IteratorUtils() { } - // Iterator creators - //---------------------------------------------------------------------- - + // Empty + //----------------------------------------------------------------------- /** * Gets an empty iterator. * <p> @@ -148,7 +146,7 @@ public class IteratorUtils { * * @return an iterator over nothing */ - public static ResetableIterator emptyIterator() { + public static ResettableIterator emptyIterator() { return EMPTY_ITERATOR; } @@ -160,7 +158,7 @@ public class IteratorUtils { * * @return a list iterator over nothing */ - public static ResetableListIterator emptyListIterator() { + public static ResettableListIterator emptyListIterator() { return EMPTY_LIST_ITERATOR; } @@ -172,7 +170,7 @@ public class IteratorUtils { * * @return an ordered iterator over nothing */ - public static ResetableOrderedIterator emptyOrderedIterator() { + public static OrderedIterator emptyOrderedIterator() { return EMPTY_ORDERED_ITERATOR; } @@ -184,7 +182,7 @@ public class IteratorUtils { * * @return a map iterator over nothing */ - public static ResetableMapIterator emptyMapIterator() { + public static MapIterator emptyMapIterator() { return EMPTY_MAP_ITERATOR; } @@ -196,10 +194,12 @@ public class IteratorUtils { * * @return a map iterator over nothing */ - public static ResetableOrderedMapIterator emptyOrderedMapIterator() { + public static OrderedMapIterator emptyOrderedMapIterator() { return EMPTY_ORDERED_MAP_ITERATOR; } + // Singleton + //----------------------------------------------------------------------- /** * Gets a singleton iterator. * <p> @@ -209,7 +209,7 @@ public class IteratorUtils { * @param object the single object over which to iterate * @return a singleton iterator over the object */ - public static ResetableIterator singletonIterator(Object object) { + public static ResettableIterator singletonIterator(Object object) { return new SingletonIterator(object); } @@ -222,13 +222,12 @@ public class IteratorUtils { * @param object the single object over which to iterate * @return a singleton list iterator over the object */ - public static ResetableListIterator singletonListIterator(Object object) { + public static ListIterator singletonListIterator(Object object) { return new SingletonListIterator(object); } // Arrays - //---------------------------------------------------------------------- - + //----------------------------------------------------------------------- /** * Gets an iterator over an object array. * @@ -236,7 +235,7 @@ public class IteratorUtils { * @return an iterator over the array * @throws NullPointerException if array is null */ - public static ResetableIterator arrayIterator(Object[] array) { + public static ResettableIterator arrayIterator(Object[] array) { return new ObjectArrayIterator(array); } @@ -251,7 +250,7 @@ public class IteratorUtils { * @throws IllegalArgumentException if the array is not an array * @throws NullPointerException if array is null */ - public static ResetableIterator arrayIterator(Object array) { + public static ResettableIterator arrayIterator(Object array) { return new ArrayIterator(array); } @@ -265,7 +264,7 @@ public class IteratorUtils { * than the length of the array * @throws NullPointerException if array is null */ - public static ResetableIterator arrayIterator(Object[] array, int start) { + public static ResettableIterator arrayIterator(Object[] array, int start) { return new ObjectArrayIterator(array, start); } @@ -283,7 +282,7 @@ public class IteratorUtils { * than the length of the array * @throws NullPointerException if array is null */ - public static ResetableIterator arrayIterator(Object array, int start) { + public static ResettableIterator arrayIterator(Object array, int start) { return new ArrayIterator(array, start); } @@ -298,7 +297,7 @@ public class IteratorUtils { * @throws IllegalArgumentException if end is before start * @throws NullPointerException if array is null */ - public static ResetableIterator arrayIterator(Object[] array, int start, int end) { + public static ResettableIterator arrayIterator(Object[] array, int start, int end) { return new ObjectArrayIterator(array, start, end); } @@ -317,10 +316,11 @@ public class IteratorUtils { * @throws IllegalArgumentException if end is before start * @throws NullPointerException if array is null */ - public static ResetableIterator arrayIterator(Object array, int start, int end) { + public static ResettableIterator arrayIterator(Object array, int start, int end) { return new ArrayIterator(array, start, end); } + //----------------------------------------------------------------------- /** * Gets a list iterator over an object array. * @@ -328,7 +328,7 @@ public class IteratorUtils { * @return a list iterator over the array * @throws NullPointerException if array is null */ - public static ResetableListIterator arrayListIterator(Object[] array) { + public static ResettableListIterator arrayListIterator(Object[] array) { return new ObjectArrayListIterator(array); } @@ -343,7 +343,7 @@ public class IteratorUtils { * @throws IllegalArgumentException if the array is not an array * @throws NullPointerException if array is null */ - public static ResetableListIterator arrayListIterator(Object array) { + public static ResettableListIterator arrayListIterator(Object array) { return new ArrayListIterator(array); } @@ -356,7 +356,7 @@ public class IteratorUtils { * @throws IndexOutOfBoundsException if start is less than zero * @throws NullPointerException if array is null */ - public static ResetableListIterator arrayListIterator(Object[] array, int start) { + public static ResettableListIterator arrayListIterator(Object[] array, int start) { return new ObjectArrayListIterator(array, start); } @@ -373,7 +373,7 @@ public class IteratorUtils { * @throws IndexOutOfBoundsException if start is less than zero * @throws NullPointerException if array is null */ - public static ResetableListIterator arrayListIterator(Object array, int start) { + public static ResettableListIterator arrayListIterator(Object array, int start) { return new ArrayListIterator(array, start); } @@ -388,7 +388,7 @@ public class IteratorUtils { * @throws IllegalArgumentException if end is before start * @throws NullPointerException if array is null */ - public static ResetableListIterator arrayListIterator(Object[] array, int start, int end) { + public static ResettableListIterator arrayListIterator(Object[] array, int start, int end) { return new ObjectArrayListIterator(array, start, end); } @@ -407,13 +407,12 @@ public class IteratorUtils { * @throws IllegalArgumentException if end is before start * @throws NullPointerException if array is null */ - public static ResetableListIterator arrayListIterator(Object array, int start, int end) { + public static ResettableListIterator arrayListIterator(Object array, int start, int end) { return new ArrayListIterator(array, start, end); } - // Iterator wrappers - //---------------------------------------------------------------------- - + // Unmodifiable + //----------------------------------------------------------------------- /** * Gets an immutable version of an {@link Iterator}. The returned object * will always throw an {@link UnsupportedOperationException} for @@ -451,6 +450,8 @@ public class IteratorUtils { return UnmodifiableMapIterator.decorate(mapIterator); } + // Chained + //----------------------------------------------------------------------- /** * Gets an iterator that iterates through two {@link Iterator}s * one after another. @@ -489,6 +490,8 @@ public class IteratorUtils { return new IteratorChain(iterators); } + // Collated + //----------------------------------------------------------------------- /** * Gets an iterator that provides an ordered iteration over the elements * contained in a collection of ordered {@link Iterator}s. @@ -548,6 +551,8 @@ public class IteratorUtils { return new CollatingIterator(comparator, iterators); } + // Transformed + //----------------------------------------------------------------------- /** * Gets an iterator that transforms the elements of another iterator. * <p> @@ -568,6 +573,8 @@ public class IteratorUtils { return new TransformIterator(iterator, transform); } + // Filtered + //----------------------------------------------------------------------- /** * Gets an iterator that filters another iterator. * <p> @@ -608,6 +615,8 @@ public class IteratorUtils { return new FilterListIterator(listIterator, predicate); } + // Looping + //----------------------------------------------------------------------- /** * Gets an iterator that loops continuously over the supplied collection. * <p> @@ -618,13 +627,15 @@ public class IteratorUtils { * @param coll the collection to iterate over, not null * @throws NullPointerException if the collection is null */ - public static ResetableIterator loopingIterator(Collection coll) { + public static ResettableIterator loopingIterator(Collection coll) { if (coll == null) { throw new NullPointerException("Collection must not be null"); } return new LoopingIterator(coll); } + // Views + //----------------------------------------------------------------------- /** * Gets an iterator that provides an iterator view of the given enumeration. * @@ -825,7 +836,7 @@ public class IteratorUtils { /** * EmptyIterator class */ - static class EmptyIterator implements ResetableIterator { + static class EmptyIterator implements ResettableIterator { EmptyIterator() { super(); @@ -852,7 +863,7 @@ public class IteratorUtils { /** * EmptyListIterator class */ - static class EmptyListIterator extends EmptyIterator implements ResetableListIterator { + static class EmptyListIterator extends EmptyIterator implements ResettableListIterator { EmptyListIterator() { super(); @@ -887,7 +898,7 @@ public class IteratorUtils { /** * EmptyOrderedIterator class */ - static class EmptyOrderedIterator extends EmptyIterator implements ResetableOrderedIterator { + static class EmptyOrderedIterator extends EmptyIterator implements OrderedIterator, ResettableIterator { EmptyOrderedIterator() { super(); @@ -906,7 +917,7 @@ public class IteratorUtils { /** * EmptyMapIterator class */ - static class EmptyMapIterator extends EmptyIterator implements ResetableMapIterator { + static class EmptyMapIterator extends EmptyIterator implements MapIterator, ResettableIterator { EmptyMapIterator() { super(); @@ -929,7 +940,7 @@ public class IteratorUtils { /** * EmptyOrderedMapIterator class */ - static class EmptyOrderedMapIterator extends EmptyMapIterator implements ResetableOrderedMapIterator { + static class EmptyOrderedMapIterator extends EmptyMapIterator implements OrderedMapIterator, ResettableIterator { EmptyOrderedMapIterator() { super(); diff --git a/src/java/org/apache/commons/collections/iterators/ArrayIterator.java b/src/java/org/apache/commons/collections/iterators/ArrayIterator.java index 1965873e8..ecb318b3d 100644 --- a/src/java/org/apache/commons/collections/iterators/ArrayIterator.java +++ b/src/java/org/apache/commons/collections/iterators/ArrayIterator.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ArrayIterator.java,v 1.6 2003/09/29 22:37:40 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ArrayIterator.java,v 1.7 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -72,7 +72,7 @@ import java.util.NoSuchElementException; * the iterator back to the start if required. * * @since Commons Collections 1.0 - * @version $Revision: 1.6 $ $Date: 2003/09/29 22:37:40 $ + * @version $Revision: 1.7 $ $Date: 2003/11/14 22:58:27 $ * * @author James Strachan * @author Mauricio S. Moura @@ -80,7 +80,7 @@ import java.util.NoSuchElementException; * @author Neil O'Toole * @author Stephen Colebourne */ -public class ArrayIterator implements ResetableIterator { +public class ArrayIterator implements ResettableIterator { /** The array to iterate over */ protected Object array; diff --git a/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java b/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java index 8f2bd3f34..315a3432e 100644 --- a/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java +++ b/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java,v 1.8 2003/10/09 20:44:32 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java,v 1.9 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -77,14 +77,14 @@ import java.util.NoSuchElementException; * @see java.util.ListIterator * * @since Commons Collections 3.0 - * @version $Revision: 1.8 $ $Date: 2003/10/09 20:44:32 $ + * @version $Revision: 1.9 $ $Date: 2003/11/14 22:58:27 $ * * @author Neil O'Toole * @author Stephen Colebourne * @author Phil Steitz */ public class ArrayListIterator extends ArrayIterator - implements ListIterator, ResetableListIterator { + implements ListIterator, ResettableListIterator { /** * Holds the index of the last item returned by a call to <code>next()</code> diff --git a/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java b/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java index e63864775..294bf3ba1 100644 --- a/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java +++ b/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java,v 1.1 2003/11/08 18:43:13 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java,v 1.2 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -73,11 +73,11 @@ import java.util.Map; * </pre> * * @since Commons Collections 3.0 - * @version $Revision: 1.1 $ $Date: 2003/11/08 18:43:13 $ + * @version $Revision: 1.2 $ $Date: 2003/11/14 22:58:27 $ * * @author Stephen Colebourne */ -public class EntrySetMapIterator implements MapIterator, ResetableMapIterator { +public class EntrySetMapIterator implements MapIterator, ResettableIterator { private final Map map; private Iterator iterator; diff --git a/src/java/org/apache/commons/collections/iterators/LoopingIterator.java b/src/java/org/apache/commons/collections/iterators/LoopingIterator.java index 68701cfaa..9ca609a39 100644 --- a/src/java/org/apache/commons/collections/iterators/LoopingIterator.java +++ b/src/java/org/apache/commons/collections/iterators/LoopingIterator.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/LoopingIterator.java,v 1.5 2003/08/31 17:25:49 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/LoopingIterator.java,v 1.6 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -72,12 +72,12 @@ import java.util.NoSuchElementException; * implementations will throw a ConcurrentModificationException. * * @since Commons Collections 3.0 - * @version $Revision: 1.5 $ $Date: 2003/08/31 17:25:49 $ + * @version $Revision: 1.6 $ $Date: 2003/11/14 22:58:27 $ * * @author <a href="mailto:joncrlsn@users.sf.net">Jonathan Carlson</a> * @author Stephen Colebourne */ -public class LoopingIterator implements ResetableIterator { +public class LoopingIterator implements ResettableIterator { /** The collection to base the iterator on */ private Collection collection; diff --git a/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java b/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java index efac56be7..ef921c0f1 100644 --- a/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java +++ b/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java,v 1.8 2003/10/10 21:06:18 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java,v 1.9 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -70,7 +70,7 @@ import java.util.NoSuchElementException; * back to the start if required. * * @since Commons Collections 3.0 - * @version $Revision: 1.8 $ $Date: 2003/10/10 21:06:18 $ + * @version $Revision: 1.9 $ $Date: 2003/11/14 22:58:27 $ * * @author James Strachan * @author Mauricio S. Moura @@ -80,7 +80,7 @@ import java.util.NoSuchElementException; * @author Phil Steitz */ public class ObjectArrayIterator - implements Iterator, ResetableIterator { + implements Iterator, ResettableIterator { /** The array */ protected Object[] array = null; diff --git a/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java b/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java index efed730b6..936c9a784 100644 --- a/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java +++ b/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java,v 1.9 2003/11/08 18:37:16 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java,v 1.10 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -74,14 +74,14 @@ import java.util.NoSuchElementException; * @see java.util.ListIterator * * @since Commons Collections 3.0 - * @version $Revision: 1.9 $ $Date: 2003/11/08 18:37:16 $ + * @version $Revision: 1.10 $ $Date: 2003/11/14 22:58:27 $ * * @author Neil O'Toole * @author Stephen Colebourne * @author Phil Steitz */ public class ObjectArrayListIterator extends ObjectArrayIterator - implements ListIterator, ResetableListIterator { + implements ListIterator, ResettableListIterator { /** * Holds the index of the last item returned by a call to <code>next()</code> diff --git a/src/java/org/apache/commons/collections/iterators/ResetableMapIterator.java b/src/java/org/apache/commons/collections/iterators/ResetableMapIterator.java deleted file mode 100644 index 6678be29a..000000000 --- a/src/java/org/apache/commons/collections/iterators/ResetableMapIterator.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/Attic/ResetableMapIterator.java,v 1.1 2003/11/02 15:27:54 scolebourne Exp $ - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2003 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowledgement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgement may appear in the software itself, - * if and wherever such third-party acknowledgements normally appear. - * - * 4. The names "The Jakarta Project", "Commons", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - * - */ -package org.apache.commons.collections.iterators; - -/** - * Interface implemented by those map iterators that can be reset back - * to an initial state. - * - * @since Commons Collections 3.0 - * @version $Revision: 1.1 $ $Date: 2003/11/02 15:27:54 $ - * - * @author Stephen Colebourne - */ -public interface ResetableMapIterator extends MapIterator, ResetableIterator { - - /** - * Resets the iterator back to the position at which the iterator - * was created. - */ - public void reset(); - -} diff --git a/src/java/org/apache/commons/collections/iterators/ResetableOrderedIterator.java b/src/java/org/apache/commons/collections/iterators/ResetableOrderedIterator.java deleted file mode 100644 index 8930c5b07..000000000 --- a/src/java/org/apache/commons/collections/iterators/ResetableOrderedIterator.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/Attic/ResetableOrderedIterator.java,v 1.1 2003/11/08 19:26:28 scolebourne Exp $ - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2003 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowledgement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgement may appear in the software itself, - * if and wherever such third-party acknowledgements normally appear. - * - * 4. The names "The Jakarta Project", "Commons", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - * - */ -package org.apache.commons.collections.iterators; - -/** - * Interface implemented by those ordered iterators that can be reset back - * to an initial state. - * - * @since Commons Collections 3.0 - * @version $Revision: 1.1 $ $Date: 2003/11/08 19:26:28 $ - * - * @author Stephen Colebourne - */ -public interface ResetableOrderedIterator extends OrderedIterator, ResetableIterator { - - /** - * Resets the iterator back to the position at which the iterator - * was created. - */ - public void reset(); - -} diff --git a/src/java/org/apache/commons/collections/iterators/ResetableOrderedMapIterator.java b/src/java/org/apache/commons/collections/iterators/ResetableOrderedMapIterator.java deleted file mode 100644 index 2a35f0b47..000000000 --- a/src/java/org/apache/commons/collections/iterators/ResetableOrderedMapIterator.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/Attic/ResetableOrderedMapIterator.java,v 1.2 2003/11/08 19:26:28 scolebourne Exp $ - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2003 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowledgement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgement may appear in the software itself, - * if and wherever such third-party acknowledgements normally appear. - * - * 4. The names "The Jakarta Project", "Commons", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - * - */ -package org.apache.commons.collections.iterators; - -/** - * Interface implemented by those map iterators that can be reset back - * to an initial state. - * - * @since Commons Collections 3.0 - * @version $Revision: 1.2 $ $Date: 2003/11/08 19:26:28 $ - * - * @author Stephen Colebourne - */ -public interface ResetableOrderedMapIterator - extends OrderedMapIterator, ResetableMapIterator, ResetableOrderedIterator { - - /** - * Resets the iterator back to the position at which the iterator - * was created. - */ - public void reset(); - -} diff --git a/src/java/org/apache/commons/collections/iterators/ResetableIterator.java b/src/java/org/apache/commons/collections/iterators/ResettableIterator.java similarity index 93% rename from src/java/org/apache/commons/collections/iterators/ResetableIterator.java rename to src/java/org/apache/commons/collections/iterators/ResettableIterator.java index c93c2dffc..2fda5509c 100644 --- a/src/java/org/apache/commons/collections/iterators/ResetableIterator.java +++ b/src/java/org/apache/commons/collections/iterators/ResettableIterator.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/Attic/ResetableIterator.java,v 1.3 2003/08/31 17:25:49 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/Attic/ResettableIterator.java,v 1.1 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -64,11 +64,11 @@ import java.util.Iterator; * initial state. * * @since Commons Collections 3.0 - * @version $Revision: 1.3 $ $Date: 2003/08/31 17:25:49 $ + * @version $Revision: 1.1 $ $Date: 2003/11/14 22:58:27 $ * * @author Stephen Colebourne */ -public interface ResetableIterator extends Iterator { +public interface ResettableIterator extends Iterator { /** * Resets the iterator back to the position at which the iterator diff --git a/src/java/org/apache/commons/collections/iterators/ResetableListIterator.java b/src/java/org/apache/commons/collections/iterators/ResettableListIterator.java similarity index 92% rename from src/java/org/apache/commons/collections/iterators/ResetableListIterator.java rename to src/java/org/apache/commons/collections/iterators/ResettableListIterator.java index c89c323f3..304af2bd6 100644 --- a/src/java/org/apache/commons/collections/iterators/ResetableListIterator.java +++ b/src/java/org/apache/commons/collections/iterators/ResettableListIterator.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/Attic/ResetableListIterator.java,v 1.3 2003/08/31 17:25:49 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/Attic/ResettableListIterator.java,v 1.1 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -64,11 +64,11 @@ import java.util.ListIterator; * to an initial state. * * @since Commons Collections 3.0 - * @version $Revision: 1.3 $ $Date: 2003/08/31 17:25:49 $ + * @version $Revision: 1.1 $ $Date: 2003/11/14 22:58:27 $ * * @author Stephen Colebourne */ -public interface ResetableListIterator extends ListIterator, ResetableIterator { +public interface ResettableListIterator extends ListIterator, ResettableIterator { /** * Resets the iterator back to the position at which the iterator diff --git a/src/java/org/apache/commons/collections/iterators/SingletonIterator.java b/src/java/org/apache/commons/collections/iterators/SingletonIterator.java index e713f064a..67c8928d7 100644 --- a/src/java/org/apache/commons/collections/iterators/SingletonIterator.java +++ b/src/java/org/apache/commons/collections/iterators/SingletonIterator.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/SingletonIterator.java,v 1.8 2003/10/09 20:44:32 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/SingletonIterator.java,v 1.9 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -65,14 +65,14 @@ import java.util.NoSuchElementException; * object instance. * * @since Commons Collections 2.0 - * @version $Revision: 1.8 $ $Date: 2003/10/09 20:44:32 $ + * @version $Revision: 1.9 $ $Date: 2003/11/14 22:58:27 $ * * @author James Strachan * @author Stephen Colebourne * @author Rodney Waldhoff */ public class SingletonIterator - implements Iterator, ResetableIterator { + implements Iterator, ResettableIterator { private boolean beforeFirst = true; private boolean removed = false; diff --git a/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java b/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java index 7a75fdd72..7f86656e1 100644 --- a/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java +++ b/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java,v 1.9 2003/11/08 18:38:27 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java,v 1.10 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -65,12 +65,12 @@ import java.util.NoSuchElementException; * object instance. * * @since Commons Collections 2.1 - * @version $Revision: 1.9 $ $Date: 2003/11/08 18:38:27 $ + * @version $Revision: 1.10 $ $Date: 2003/11/14 22:58:27 $ * * @author Stephen Colebourne * @author Rodney Waldhoff */ -public class SingletonListIterator implements ListIterator, ResetableListIterator { +public class SingletonListIterator implements ListIterator, ResettableListIterator { private boolean beforeFirst = true; private boolean nextCalled = false; diff --git a/src/test/org/apache/commons/collections/TestIteratorUtils.java b/src/test/org/apache/commons/collections/TestIteratorUtils.java index 40ca3510a..6d4ae8e32 100644 --- a/src/test/org/apache/commons/collections/TestIteratorUtils.java +++ b/src/test/org/apache/commons/collections/TestIteratorUtils.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestIteratorUtils.java,v 1.10 2003/11/08 19:26:29 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestIteratorUtils.java,v 1.11 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -69,16 +69,13 @@ import junit.framework.Test; import org.apache.commons.collections.iterators.MapIterator; import org.apache.commons.collections.iterators.OrderedIterator; import org.apache.commons.collections.iterators.OrderedMapIterator; -import org.apache.commons.collections.iterators.ResetableIterator; -import org.apache.commons.collections.iterators.ResetableListIterator; -import org.apache.commons.collections.iterators.ResetableMapIterator; -import org.apache.commons.collections.iterators.ResetableOrderedIterator; -import org.apache.commons.collections.iterators.ResetableOrderedMapIterator; +import org.apache.commons.collections.iterators.ResettableIterator; +import org.apache.commons.collections.iterators.ResettableListIterator; /** * Tests for IteratorUtils. * - * @version $Revision: 1.10 $ $Date: 2003/11/08 19:26:29 $ + * @version $Revision: 1.11 $ $Date: 2003/11/14 22:58:27 $ * * @author Unknown */ @@ -125,7 +122,7 @@ public class TestIteratorUtils extends BulkTest { public void testArrayIterator() { Object[] objArray = {"a", "b", "c"}; - ResetableIterator iterator = IteratorUtils.arrayIterator(objArray); + ResettableIterator iterator = IteratorUtils.arrayIterator(objArray); assertTrue(iterator.next().equals("a")); assertTrue(iterator.next().equals("b")); iterator.reset(); @@ -245,7 +242,7 @@ public class TestIteratorUtils extends BulkTest { public void testArrayListIterator() { Object[] objArray = {"a", "b", "c", "d"}; - ResetableListIterator iterator = IteratorUtils.arrayListIterator(objArray); + ResettableListIterator iterator = IteratorUtils.arrayListIterator(objArray); assertTrue(!iterator.hasPrevious()); assertTrue(iterator.previousIndex() == -1); assertTrue(iterator.nextIndex() == 0); @@ -436,7 +433,7 @@ public class TestIteratorUtils extends BulkTest { */ public void testEmptyIterator() { assertTrue(IteratorUtils.EMPTY_ITERATOR instanceof Iterator); - assertTrue(IteratorUtils.EMPTY_ITERATOR instanceof ResetableIterator); + assertTrue(IteratorUtils.EMPTY_ITERATOR instanceof ResettableIterator); assertEquals(false, IteratorUtils.EMPTY_ITERATOR.hasNext()); IteratorUtils.EMPTY_ITERATOR.reset(); assertSame(IteratorUtils.EMPTY_ITERATOR, IteratorUtils.EMPTY_ITERATOR); @@ -458,8 +455,8 @@ public class TestIteratorUtils extends BulkTest { public void testEmptyListIterator() { assertTrue(IteratorUtils.EMPTY_LIST_ITERATOR instanceof Iterator); assertTrue(IteratorUtils.EMPTY_LIST_ITERATOR instanceof ListIterator); - assertTrue(IteratorUtils.EMPTY_LIST_ITERATOR instanceof ResetableIterator); - assertTrue(IteratorUtils.EMPTY_LIST_ITERATOR instanceof ResetableListIterator); + assertTrue(IteratorUtils.EMPTY_LIST_ITERATOR instanceof ResettableIterator); + assertTrue(IteratorUtils.EMPTY_LIST_ITERATOR instanceof ResettableListIterator); assertEquals(false, IteratorUtils.EMPTY_LIST_ITERATOR.hasNext()); assertEquals(0, IteratorUtils.EMPTY_LIST_ITERATOR.nextIndex()); assertEquals(-1, IteratorUtils.EMPTY_LIST_ITERATOR.previousIndex()); @@ -495,10 +492,9 @@ public class TestIteratorUtils extends BulkTest { public void testEmptyMapIterator() { assertTrue(IteratorUtils.EMPTY_MAP_ITERATOR instanceof Iterator); assertTrue(IteratorUtils.EMPTY_MAP_ITERATOR instanceof MapIterator); - assertTrue(IteratorUtils.EMPTY_MAP_ITERATOR instanceof ResetableIterator); - assertTrue(IteratorUtils.EMPTY_MAP_ITERATOR instanceof ResetableMapIterator); + assertTrue(IteratorUtils.EMPTY_MAP_ITERATOR instanceof ResettableIterator); assertEquals(false, IteratorUtils.EMPTY_MAP_ITERATOR.hasNext()); - IteratorUtils.EMPTY_MAP_ITERATOR.reset(); + ((ResettableIterator) IteratorUtils.EMPTY_MAP_ITERATOR).reset(); assertSame(IteratorUtils.EMPTY_MAP_ITERATOR, IteratorUtils.EMPTY_MAP_ITERATOR); assertSame(IteratorUtils.EMPTY_MAP_ITERATOR, IteratorUtils.emptyMapIterator()); try { @@ -530,11 +526,10 @@ public class TestIteratorUtils extends BulkTest { public void testEmptyOrderedIterator() { assertTrue(IteratorUtils.EMPTY_ORDERED_ITERATOR instanceof Iterator); assertTrue(IteratorUtils.EMPTY_ORDERED_ITERATOR instanceof OrderedIterator); - assertTrue(IteratorUtils.EMPTY_ORDERED_ITERATOR instanceof ResetableIterator); - assertTrue(IteratorUtils.EMPTY_ORDERED_ITERATOR instanceof ResetableOrderedIterator); + assertTrue(IteratorUtils.EMPTY_ORDERED_ITERATOR instanceof ResettableIterator); assertEquals(false, IteratorUtils.EMPTY_ORDERED_ITERATOR.hasNext()); assertEquals(false, IteratorUtils.EMPTY_ORDERED_ITERATOR.hasPrevious()); - IteratorUtils.EMPTY_ORDERED_ITERATOR.reset(); + ((ResettableIterator) IteratorUtils.EMPTY_ORDERED_ITERATOR).reset(); assertSame(IteratorUtils.EMPTY_ORDERED_ITERATOR, IteratorUtils.EMPTY_ORDERED_ITERATOR); assertSame(IteratorUtils.EMPTY_ORDERED_ITERATOR, IteratorUtils.emptyOrderedIterator()); try { @@ -559,13 +554,10 @@ public class TestIteratorUtils extends BulkTest { assertTrue(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof Iterator); assertTrue(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof MapIterator); assertTrue(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof OrderedMapIterator); - assertTrue(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof ResetableIterator); - assertTrue(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof ResetableMapIterator); - assertTrue(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof ResetableOrderedIterator); - assertTrue(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof ResetableOrderedMapIterator); + assertTrue(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof ResettableIterator); assertEquals(false, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR.hasNext()); assertEquals(false, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR.hasPrevious()); - IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR.reset(); + ((ResettableIterator) IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR).reset(); assertSame(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR); assertSame(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR, IteratorUtils.emptyOrderedMapIterator()); try { diff --git a/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.java b/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.java index 94992d40c..72ef1a6a1 100644 --- a/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.java +++ b/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.java,v 1.7 2003/10/09 11:05:27 rwaldhoff Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.java,v 1.8 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -67,7 +67,7 @@ import junit.framework.TestSuite; * Tests the SingletonIterator to ensure that the next() method will actually * perform the iteration rather than the hasNext() method. * - * @version $Revision: 1.7 $ $Date: 2003/10/09 11:05:27 $ + * @version $Revision: 1.8 $ $Date: 2003/11/14 22:58:27 $ * * @author James Strachan */ @@ -126,7 +126,7 @@ public class TestSingletonIterator extends AbstractTestIterator { } public void testSingletonIteratorRemove() { - ResetableIterator iter = new SingletonIterator("xyzzy"); + ResettableIterator iter = new SingletonIterator("xyzzy"); assertTrue(iter.hasNext()); assertEquals("xyzzy",iter.next()); iter.remove(); @@ -135,7 +135,7 @@ public class TestSingletonIterator extends AbstractTestIterator { } public void testReset() { - ResetableIterator it = (ResetableIterator) makeObject(); + ResettableIterator it = (ResettableIterator) makeObject(); assertEquals(true, it.hasNext()); assertEquals(testValue, it.next()); diff --git a/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java b/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java index ec88839c1..14b202646 100644 --- a/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java +++ b/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java,v 1.7 2003/10/09 11:05:27 rwaldhoff Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java,v 1.8 2003/11/14 22:58:27 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -66,7 +66,7 @@ import junit.framework.TestSuite; /** * Tests the SingletonListIterator. * - * @version $Revision: 1.7 $ $Date: 2003/10/09 11:05:27 $ + * @version $Revision: 1.8 $ $Date: 2003/11/14 22:58:27 $ * * @author Stephen Colebourne */ @@ -157,7 +157,7 @@ public class TestSingletonListIterator extends AbstractTestListIterator { } public void testReset() { - ResetableListIterator it = (ResetableListIterator) makeObject(); + ResettableListIterator it = (ResettableListIterator) makeObject(); assertEquals(true, it.hasNext()); assertEquals(false, it.hasPrevious());