Here you can find the source of asStringOn(StringBuffer sb, Iterator iter, String separator)
Parameter | Description |
---|---|
sb | StringBuffer |
iter | Iterator |
separator | String |
public static void asStringOn(StringBuffer sb, Iterator iter, String separator)
//package com.java2s; /**/*from w ww. ja v a2 s . c om*/ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ import java.util.Iterator; public class Main { /** * Copies the elements returned by the iterator onto the string buffer * each delimited by the separator. * * @param sb StringBuffer * @param iter Iterator * @param separator String */ public static void asStringOn(StringBuffer sb, Iterator iter, String separator) { if (!iter.hasNext()) return; sb.append(iter.next()); while (iter.hasNext()) { sb.append(separator); sb.append(iter.next()); } } }