/** * Constructs an ArrayIterator that will iterate over the values in the * specified array. * * @param array the array to iterate over. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> */ public ArrayIterator(final Object array) { super(); setArray(array); }
/** * Constructs an ArrayIterator that will iterate over the values in the * specified array. * * @param array the array to iterate over. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> */ public ArrayIterator(final Object array) { super(); setArray(array); }
/** * Constructs an ArrayIterator that will iterate over the values in the * specified array from a specific start index. * * @param array the array to iterate over. * @param startIndex the index to start iterating at. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> * @throws IndexOutOfBoundsException if the index is invalid */ public ArrayIterator(final Object array, final int startIndex) { super(); setArray(array); checkBound(startIndex, "start"); this.startIndex = startIndex; this.index = startIndex; }
/** * Constructs an ArrayIterator that will iterate over the values in the * specified array from a specific start index. * * @param array the array to iterate over. * @param startIndex the index to start iterating at. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> * @throws IndexOutOfBoundsException if the index is invalid */ public ArrayIterator(final Object array, final int startIndex) { super(); setArray(array); checkBound(startIndex, "start"); this.startIndex = startIndex; this.index = startIndex; }
/** * Construct an ArrayIterator that will iterate over a range of values * in the specified array. * * @param array the array to iterate over. * @param startIndex the index to start iterating at. * @param endIndex the index to finish iterating at. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> * @throws IndexOutOfBoundsException if either index is invalid */ public ArrayIterator(final Object array, final int startIndex, final int endIndex) { super(); setArray(array); checkBound(startIndex, "start"); checkBound(endIndex, "end"); if (endIndex < startIndex) { throw new IllegalArgumentException("End index must not be less than start index."); } this.startIndex = startIndex; this.endIndex = endIndex; this.index = startIndex; }
/** * Construct an ArrayIterator that will iterate over a range of values * in the specified array. * * @param array the array to iterate over. * @param startIndex the index to start iterating at. * @param endIndex the index to finish iterating at. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> * @throws IndexOutOfBoundsException if either index is invalid */ public ArrayIterator(final Object array, final int startIndex, final int endIndex) { super(); setArray(array); checkBound(startIndex, "start"); checkBound(endIndex, "end"); if (endIndex < startIndex) { throw new IllegalArgumentException("End index must not be less than start index."); } this.startIndex = startIndex; this.endIndex = endIndex; this.index = startIndex; }
public void testSetArray() { Iterator iter1 = makeArrayIterator(testArray); int count1 = 0; while (iter1.hasNext()) { ++count1; iter1.next(); } assertEquals("the count should be right using the constructor", count1, testArray.length); ArrayIterator iter2 = makeArrayIterator(); iter2.setArray(testArray); int count2 = 0; while (iter2.hasNext()) { ++count2; iter2.next(); } assertEquals("the count should be right using setArray(Object)", count2, testArray.length); }
public void testNullArray() { try { Iterator iter = new ArrayIterator(null); fail("Constructor should throw a NullPointerException when constructed with a null array"); } catch (NullPointerException e) { // expected } ArrayIterator iter = new ArrayIterator(); try { iter.setArray(null); fail("setArray(null) should throw a NullPointerException"); } catch (NullPointerException e) { // expected } }
/** * Constructs an ArrayIterator that will iterate over the values in the * specified array. * * @param array the array to iterate over. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> */ public ArrayIterator(final Object array) { super(); setArray(array); }
/** * Constructs an ArrayIterator that will iterate over the values in the * specified array. * * @param array the array to iterate over. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> */ public ArrayIterator(final Object array) { super(); setArray(array); }
/** * Constructs an ArrayIterator that will iterate over the values in the * specified array. * * @param array the array to iterate over. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> */ public ArrayIterator(final Object array) { super(); setArray(array); }
/** * Constructs an ArrayIterator that will iterate over the values in the * specified array. * * @param array the array to iterate over. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> */ public ArrayIterator(final Object array) { super(); setArray(array); }
/** * Constructs an ArrayIterator that will iterate over the values in the * specified array. * * @param array the array to iterate over. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> */ public ArrayIterator(final Object array) { super(); setArray(array); }
/** * Constructs an ArrayIterator that will iterate over the values in the * specified array from a specific start index. * * @param array the array to iterate over. * @param startIndex the index to start iterating at. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> * @throws IndexOutOfBoundsException if the index is invalid */ public ArrayIterator(final Object array, final int startIndex) { super(); setArray(array); checkBound(startIndex, "start"); this.startIndex = startIndex; this.index = startIndex; }
/** * Constructs an ArrayIterator that will iterate over the values in the * specified array from a specific start index. * * @param array the array to iterate over. * @param startIndex the index to start iterating at. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> * @throws IndexOutOfBoundsException if the index is invalid */ public ArrayIterator(final Object array, final int startIndex) { super(); setArray(array); checkBound(startIndex, "start"); this.startIndex = startIndex; this.index = startIndex; }
/** * Constructs an ArrayIterator that will iterate over the values in the * specified array from a specific start index. * * @param array the array to iterate over. * @param startIndex the index to start iterating at. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> * @throws IndexOutOfBoundsException if the index is invalid */ public ArrayIterator(final Object array, final int startIndex) { super(); setArray(array); checkBound(startIndex, "start"); this.startIndex = startIndex; this.index = startIndex; }
/** * Constructs an ArrayIterator that will iterate over the values in the * specified array from a specific start index. * * @param array the array to iterate over. * @param startIndex the index to start iterating at. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> * @throws IndexOutOfBoundsException if the index is invalid */ public ArrayIterator(final Object array, final int startIndex) { super(); setArray(array); checkBound(startIndex, "start"); this.startIndex = startIndex; this.index = startIndex; }
/** * Constructs an ArrayIterator that will iterate over the values in the * specified array from a specific start index. * * @param array the array to iterate over. * @param startIndex the index to start iterating at. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> * @throws IndexOutOfBoundsException if the index is invalid */ public ArrayIterator(final Object array, final int startIndex) { super(); setArray(array); checkBound(startIndex, "start"); this.startIndex = startIndex; this.index = startIndex; }
/** * Construct an ArrayIterator that will iterate over a range of values * in the specified array. * * @param array the array to iterate over. * @param startIndex the index to start iterating at. * @param endIndex the index to finish iterating at. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> * @throws IndexOutOfBoundsException if either index is invalid */ public ArrayIterator(final Object array, final int startIndex, final int endIndex) { super(); setArray(array); checkBound(startIndex, "start"); checkBound(endIndex, "end"); if (endIndex < startIndex) { throw new IllegalArgumentException("End index must not be less than start index."); } this.startIndex = startIndex; this.endIndex = endIndex; this.index = startIndex; }
/** * Construct an ArrayIterator that will iterate over a range of values * in the specified array. * * @param array the array to iterate over. * @param startIndex the index to start iterating at. * @param endIndex the index to finish iterating at. * @throws IllegalArgumentException if <code>array</code> is not an array. * @throws NullPointerException if <code>array</code> is <code>null</code> * @throws IndexOutOfBoundsException if either index is invalid */ public ArrayIterator(final Object array, final int startIndex, final int endIndex) { super(); setArray(array); checkBound(startIndex, "start"); checkBound(endIndex, "end"); if (endIndex < startIndex) { throw new IllegalArgumentException("End index must not be less than start index."); } this.startIndex = startIndex; this.endIndex = endIndex; this.index = startIndex; }