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

Enumeration to Iterator 

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 Enumeration to Iterator.

File Name  :  
com/bethecoder/tutorials/ostermillerutils/Enumeration2IteratorTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.ostermillerutils;

import java.util.Arrays;
import java.util.Iterator;
import java.util.Vector;

import com.Ostermiller.util.EnumerationIterator;

public class Enumeration2IteratorTest {

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

    Vector<String> vec = new Vector<String>(Arrays.asList("ONE""TWO""THREE""FOUR"));
    Iterator<String> it = new EnumerationIterator<String>(
        vec.elements()
    );
    
    while (it.hasNext()) {
      System.out.println(it.next());
    }
  }

}
   

It gives the following output,
ONE
TWO
THREE
FOUR


                    Print

   



Books Recommendation

 
 
bl  br