[3067] in java-interest

home help back first fref pref prev next nref lref last post

Re: How to do enumeration

daemon@ATHENA.MIT.EDU (Thomas Ball)
Sat Oct 28 18:50:09 1995

Date: Sat, 28 Oct 1995 14:06:39 -0700
From: Thomas.Ball@Eng.Sun.COM (Thomas Ball)
To: ibalkhi@dnt.dialog.com
Cc: java-interest@java.Eng.Sun.COM

>  	Is there a enumeration class in java. Can somebody provide me 
>  with an example or alternative to do enumeration in java.

There are no classes per se, but java.util.Enumeration is an interface
implemented by many classes, including the collection classes in 
java.util.  Here's how one might enumerate a HashTable:

	HashTable ht;

	Enumeration e = ht.elements();
	while (e.hasMoreElements()) {
		Object o = e.nextElement();
		...
	}

Tom Ball
Java Products Group
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post