Listing 10: The IteratorAdapterTest classthe client application
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
public class IteratorAdapterTest
{
public static void main(String[] args)
{
System.out.println("-- Iterator Adapter Test Application --");
System.out.println();
System.out.println("Enumerating Through the JavaBoutique Articles");
System.out.println("Written by Barry Burd and Michael Redlich");
System.out.println();
List<String> list = new ArrayList<String>();
list.add("James: The Java Apache Mail Enterprise Server, " +
"September 30, 2005");
list.add("Avoid Excessive Subclassing with the " +
"Decorator Design Pattern, " +
"January 27, 2006");
list.add("Keeping Your Java Objects Informed with the " +
"Observer Design Pattern, " +
"June 19, 2006");
list.add("Manufacturing Java Objects with the " +
"Factory Design Pattern, " +
"August 14, 2006");
Iterator iterator = list.iterator();
Enumeration enumeration = new IteratorAdapter(iterator);
int i = 1;
while(enumeration.hasMoreElements())
{
System.out.println(i + ": " + enumeration.nextElement());
++i;
}
}
}
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|