- All Known Subinterfaces:
- NamingEnumeration<T>
- All Known Implementing Classes:
- StringTokenizer
- See Also:
- Top Examples, Source Code,
Iterator
,
SequenceInputStream
,
nextElement()
,
Hashtable
,
Hashtable.elements()
,
Hashtable.keys()
,
Vector
,
Vector.elements()
boolean hasMoreElements()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[22]Enumerate through all request parameters
By Max Okist on 2005/04/03 18:33:57 Rate
Enumeration e = request.getParameterNames ( ) ;
while ( e.hasMoreElements ( ) ) {
String name = ( String ) e.nextElement ( ) ;
System.out.println ( "Parameter = " + name ) ;
}
E nextElement()
- See Also:
- NoSuchElementException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1238]Enumerate through a vector
By srinivasa Rao Meenavalli on 2005/01/16 19:18:28 Rate
import java.util.Enumeration;
import java.util.Vector;
public class EnumerationExample
{
public static void main ( String [ ] args )
{
Vector intVector=new Vector ( ) ;
intVector.addElement ( new Integer ( 10 ) ) ;
intVector.addElement ( new Integer ( 20 ) ) ;
intVector.addElement ( new Integer ( 30 ) ) ;
intVector.addElement ( new Integer ( 40 ) ) ;
intVector.addElement ( new Integer ( 50 ) ) ;
intVector.addElement ( new Integer ( 60 ) ) ;
intVector.addElement ( new Integer ( 70 ) ) ;
intVector.addElement ( new Integer ( 80 ) ) ;
Enumeration elements=intVector.elements ( ) ;
while ( elements.hasMoreElements ( ) ) {
int element= ( ( Integer ) elements.nextElement ( ) ) .intValue ( ) ;
System.out.print ( "\t"+element ) ;
}
System.out.println ( "\n" ) ;
}
}