Here you can find the source of concatinateElements(Iterator> it)
private static String concatinateElements(Iterator<?> it)
//package com.java2s; /***************************************************************************** * This file is part of the Prolog Development Tool (PDT) * /*from w ww .j a v a 2 s.c om*/ * Author: Lukas Degener (among others) * WWW: http://sewiki.iai.uni-bonn.de/research/pdt/start * Mail: pdt@lists.iai.uni-bonn.de * Copyright (C): 2004-2012, CS Dept. III, University of Bonn * * All rights reserved. This program is made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * ****************************************************************************/ import java.util.Iterator; public class Main { private static String concatinateElements(Iterator<?> it) { StringBuffer sb = new StringBuffer(); boolean first = true; while (it.hasNext()) { if (!first) { sb.append(", "); } Object next = it.next(); String elm = next == null ? "<null>" : next.toString(); sb.append(elm); first = false; } return sb.toString(); } }