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

Reply via email to