Returns a string representation of iterator, with the format [e1, e2, ..., en]. The iterator will be left exhausted: its hasNext() method will return false.
(Iterator<?> iterator)
| 292 | * {@code hasNext()} method will return {@code false}. |
| 293 | */ |
| 294 | public static String toString(Iterator<?> iterator) { |
| 295 | return Collections2.STANDARD_JOINER |
| 296 | .appendTo(new StringBuilder().append('['), iterator) |
| 297 | .append(']') |
| 298 | .toString(); |
| 299 | } |
| 300 | |
| 301 | /** |
| 302 | * Returns the single element contained in {@code iterator}. |