Another thing you can do is make an object that implements Enumeration and
that takes an array as an arguemnt, or an Enumeration to construct an array
from it.
Then with an internal Array, you can have additional methods to reset the
Enumeration or reverse it.
Of course, you will probably want to construct a new interface that extends
Enumeration and declare your new methods to be implemented by your new
Object (perhaps an inner class) so that you can return it from a method as
an Object of that new interface type and hence do real Object Oriented
Programming.
Eric R. Dunstan
KeepSmart 2000 A.D.
>From: Rob van Oostrum <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
> reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Diff. Bet. Enumeration and Array
>Date: Wed, 14 Jun 2000 11:05:44 +0200
>
>An array is a collection of elements keyed by an index number (or, in the
>case of a multi-dimensional array, multiple index numbers, one for each
>dimension). Elements can be directly accessed by this index.
>
>An Enumeration is a collection of elements specifically designed to
>optimize
>traversing down a list of elements in optimal fashion. The Enumeration does
>not know how big it is. It has a pointer which points to the current
>element. The Enumeration is only able to return the next element, or tell
>whether or not there is a next element. Therefor, the enumeration can only
>be traversed once and is useless after that.
>
>If you want to determine the size of an Enumeration you'll have to do
>something like this:
>
>int count=0;
>while ( enum.hasMoreElements() )
>{
> enum.nextElement();
> count++;
>}
>
>System.out.println( "Size of enum is " + count );
>
>
>
>hope this helps
>Rob
>
>-----Original Message-----
>Hi,
>
>Pl. can anybody tell me the difference between an Enumeration and an
>Array.
>Is there any function available to get the count of items in the
>Enumeration.
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets