ariba.util.core
Class SubsetIterator

java.lang.Object
  extended by ariba.util.core.SubsetIterator
All Implemented Interfaces:
java.util.Iterator

public final class SubsetIterator
extends java.lang.Object
implements java.util.Iterator

A SubsetIterator produces a series of subsets of the requested size from a source array of objects.


Constructor Summary
SubsetIterator(java.lang.Object[] source, int subsetSize)
          Creates a new SubsetIterator for the given source array, where each subset will be of the given subsetSize.
SubsetIterator(java.lang.Object[] source, int subsetSize, java.lang.Object[] result)
          Creates a new SubsetIterator for the given source array, where each subset will be of the given subsetSize.
 
Method Summary
 boolean hasNext()
          Returns true if the SubsetIterator has more elements.
static void main(java.lang.String[] args)
          The first argument is assumed to be an integer which is the requested subset size.
 java.lang.Object next()
          Returns the next element of this SubsetIterator as an array of Objects.
 void remove()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubsetIterator

public SubsetIterator(java.lang.Object[] source,
                      int subsetSize)
Creates a new SubsetIterator for the given source array, where each subset will be of the given subsetSize.


SubsetIterator

public SubsetIterator(java.lang.Object[] source,
                      int subsetSize,
                      java.lang.Object[] result)
Creates a new SubsetIterator for the given source array, where each subset will be of the given subsetSize. The caller provides the result array which will be returned in each successful call to next().

Method Detail

hasNext

public boolean hasNext()
Returns true if the SubsetIterator has more elements.

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Returns the next element of this SubsetIterator as an array of Objects. Throws a NoSuchElementException if there is no next elemement, i.e. if hasNext() returned false.

Specified by:
next in interface java.util.Iterator

remove

public void remove()
Specified by:
remove in interface java.util.Iterator

main

public static void main(java.lang.String[] args)
The first argument is assumed to be an integer which is the requested subset size. The remaining arguments are used as the elements of the full set.



AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.