Here you can find the source of toString(Collection extends Object> collection)
Parameter | Description |
---|---|
collection | a parameter |
public static String toString(Collection<? extends Object> collection)
//package com.java2s; import java.util.Collection; import java.util.Iterator; public class Main { /**/*from w w w . ja va2s. c om*/ * Method description * * * @param collection * * @return */ public static String toString(Collection<? extends Object> collection) { StringBuilder sb = new StringBuilder(); if (collection != null) { Iterator<? extends Object> it = collection.iterator(); while (it.hasNext()) { sb.append(it.next()); if (it.hasNext()) { sb.append(", "); } } } return sb.toString(); } /** * Method description * * * @param byteValue * * @return */ public static String toString(byte[] byteValue) { StringBuilder buffer = new StringBuilder(); for (int i = 0; i < byteValue.length; i++) { int x = byteValue[i] & 0xff; if (x < 16) { buffer.append('0'); } buffer.append(Integer.toString(x, 16)); } return buffer.toString(); } }