MCPcopy Create free account
hub / github.com/davidgiven/luje / toString

Method toString

lib/java/util/AbstractCollection.java:373–395  ·  view source on GitHub ↗

Returns the string representation of this Collection. The presentation has a specific format. It is enclosed by square brackets ("[]"). Elements are separated by ', ' (comma and space). @return the string representation of this Collection.

()

Source from the content-addressed store, hash-verified

371 * @return the string representation of this {@code Collection}.
372 */
373 @Override
374 public String toString() {
375 if (isEmpty()) {
376 return "[]"; //$NON-NLS-1$
377 }
378
379 StringBuilder buffer = new StringBuilder(size() * 16);
380 buffer.append('[');
381 Iterator<?> it = iterator();
382 while (it.hasNext()) {
383 Object next = it.next();
384 if (next != this) {
385 buffer.append(next);
386 } else {
387 buffer.append("(this Collection)"); //$NON-NLS-1$
388 }
389 if (it.hasNext()) {
390 buffer.append(", "); //$NON-NLS-1$
391 }
392 }
393 buffer.append(']');
394 return buffer.toString();
395 }
396}

Callers

nothing calls this directly

Calls 7

isEmptyMethod · 0.95
sizeMethod · 0.95
appendMethod · 0.95
iteratorMethod · 0.95
toStringMethod · 0.95
hasNextMethod · 0.65
nextMethod · 0.65

Tested by

no test coverage detected