Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Iterator; import java.util.List; public class Main { public static void printListThroughIterator(List list, String logTag) { StringBuilder sb = new StringBuilder(); for (Iterator iter = list.iterator(); iter.hasNext();) { sb.append(iter.next() + " "); } System.out.println(logTag + " " + "printListThroughRandomAccess::" + sb.toString()); } }