Java tutorial
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static String iteratorToString(Iterator<? extends Object> iter) { if (iter != null) { StringBuilder sb = new StringBuilder(); for (; iter.hasNext();) { sb.append(iter.next().toString()); } return sb.toString(); } else { return ""; } } }