iaik.utils
Class ArrayEnumeration

java.lang.Object
  |
  +--iaik.utils.ArrayEnumeration
All Implemented Interfaces:
Enumeration

public class ArrayEnumeration
extends Object
implements Enumeration

This class implements a simple Enumeration over an array.

When creating an ArrayEnumeration from an array of objects you optionally may specify the number of elements of the array that shall admit to the ArrayEnumeration, e.g.:

 SomeObject[] obj = ...;
 ArrayEnumeration arrayEnum = new ArrayEnumeration(obj, 2);
 
will create an ArrayEnumaeration of the first two elements of the given array of objects.

For getting the elements of an ArrayEnumeration use the hasMoreElements and nextElement methods, as already familiarly from the java.util.Enumeration, e.g.:

 for (; arrEnum.hasMoreElements() ; ) {
    System.out.println(arrayEnum.nextElement());
 }
 

Version:
File Revision 13

Constructor Summary
ArrayEnumeration(Object[] array)
          Creates a new ArrayEnumeration from all the elements included in the given array of objects.
ArrayEnumeration(Object[] array, int length)
          Creates a new ArrayEnumeration from the given number of elements of the given array of objects.
 
Method Summary
 boolean hasMoreElements()
          Checks if there are more elements in this ArrayEnumeration.
 Object nextElement()
          Returns the next element of this ArrayEnumeration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayEnumeration

public ArrayEnumeration(Object[] array)
Creates a new ArrayEnumeration from all the elements included in the given array of objects.
Parameters:
array - the array

ArrayEnumeration

public ArrayEnumeration(Object[] array,
                        int length)
Creates a new ArrayEnumeration from the given number of elements of the given array of objects.

The first length elements of the given array will admit to the new ArrayEnumeration.

Parameters:
array - the array
Method Detail

hasMoreElements

public boolean hasMoreElements()
Checks if there are more elements in this ArrayEnumeration.
Specified by:
hasMoreElements in interface Enumeration
Returns:
true if there are more elements, false if not

nextElement

public Object nextElement()
Returns the next element of this ArrayEnumeration.
Specified by:
nextElement in interface Enumeration
Returns:
the next element.

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK