Here you can find the source of toString(final Collection> values)
Parameter | Description |
---|---|
values | a parameter |
public static String toString(final Collection<?> values)
//package com.java2s; /******************************************************************************* * Manchester Institute of Biotechnology * University of Manchester/*from w w w. j av a 2s. c om*/ * Manchester M1 7ND * United Kingdom * * Copyright (C) 2013 University of Manchester * * This program is released under the Academic Free License ("AFL") v3.0. * (http://www.opensource.org/licenses/academic.php) *******************************************************************************/ import java.util.*; public class Main { /** * */ private static final String COLLECTION_SEPARATOR = ", "; /** * */ private static final int COLLECTION_SEPARATOR_LENGTH = COLLECTION_SEPARATOR .length(); /** * * @param values * @return String */ public static String toString(final Collection<?> values) { final StringBuilder builder = new StringBuilder(); for (Object value : values) { builder.append(value); builder.append(COLLECTION_SEPARATOR); } if (values.size() > 0) { builder.setLength(builder.length() - COLLECTION_SEPARATOR_LENGTH); } return builder.toString(); } }