Here you can find the source of collectionToString(final Collection> aCol, final String aSepLines)
Parameter | Description |
---|---|
aCol | a parameter |
aSepLines | a parameter |
public static String collectionToString(final Collection<?> aCol, final String aSepLines)
//package com.java2s; /******************************************************************************* * Copyright (c) 2011 www.isandlatech.com (www.isandlatech.com) * All rights reserved. This program and the accompanying materials * are 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 * * Contributors:// w w w.ja v a2s . c o m * ogattaz (isandlaTech) - initial API and implementation *******************************************************************************/ import java.util.Collection; import java.util.Iterator; public class Main { /** * @param aCol * @param aSepLines * @return */ public static String collectionToString(final Collection<?> aCol, final String aSepLines) { StringBuilder wRes = new StringBuilder(2048); Iterator<?> wIt = aCol.iterator(); while (wIt.hasNext()) { if (wRes.length() != 0) { wRes.append(aSepLines); } Object wObj = wIt.next(); if (wObj == null) { wRes.append("null"); } else { wRes.append(wObj.toString()); } } return wRes.toString(); } }