An implementation of Collection#toString().
(final Collection<?> collection)
| 297 | */ |
| 298 | |
| 299 | static String toStringImpl(final Collection<?> collection) { |
| 300 | StringBuilder sb = newStringBuilderForCollection(collection.size()).append('['); |
| 301 | STANDARD_JOINER.appendTo(sb, Iterables.transform(collection, new Function<Object, Object>() { |
| 302 | @Override |
| 303 | public Object apply(Object input) { |
| 304 | return input == collection ? "(this Collection)" : input; |
| 305 | } |
| 306 | })); |
| 307 | return sb.append(']').toString(); |
| 308 | } |
| 309 | |
| 310 | /** |
| 311 | * Returns best-effort-sized StringBuilder based on the given collection size. |
no test coverage detected