tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > Ostermiller Utilities > Iterator to Enumeration

Iterator to Enumeration 

Ostermiller Java Utilities contain various components such as CSV parsing, Base64 Encoding, MD5 digest, String and Exec Helper classes. This requires the library ostermillerutils-1.08.01.jar to be in classpath. The following example shows converting an Iterator to Enumeration.

File Name  :  
com/bethecoder/tutorials/ostermillerutils/Iterator2EnumerationTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.ostermillerutils;

import java.util.Arrays;
import java.util.Enumeration;

import com.Ostermiller.util.IteratorEnumeration;

public class Iterator2EnumerationTest {

  /**
   @param args
   */
  public static void main(String[] args) {

    Enumeration<String> enu = new IteratorEnumeration<String>(
        Arrays.asList("ONE""TWO""THREE""FOUR").iterator()
    );
    
    while (enu.hasMoreElements()) {
      System.out.println(enu.nextElement());
    }
  }

}
   

It gives the following output,
ONE
TWO
THREE
FOUR



 
  


  
bl  br