| 619 | /// |
| 620 | /// the string representation of this map. |
| 621 | @Override |
| 622 | public String toString() { |
| 623 | if (isEmpty()) { |
| 624 | return "{}"; //$NON-NLS-1$ |
| 625 | } |
| 626 | |
| 627 | StringBuffer buffer = new StringBuffer(size() * 28); |
| 628 | buffer.append('{'); |
| 629 | Iterator<Map.Entry<K, V>> it = entrySet().iterator(); |
| 630 | while (it.hasNext()) { |
| 631 | Map.Entry<K, V> entry = it.next(); |
| 632 | Object key = entry.getKey(); |
| 633 | if (key != this) { |
| 634 | buffer.append(key); |
| 635 | } else { |
| 636 | buffer.append("(this Map)"); //$NON-NLS-1$ |
| 637 | } |
| 638 | buffer.append('='); |
| 639 | Object value = entry.getValue(); |
| 640 | if (value != this) { |
| 641 | buffer.append(value); |
| 642 | } else { |
| 643 | buffer.append("(this Map)"); //$NON-NLS-1$ |
| 644 | } |
| 645 | if (it.hasNext()) { |
| 646 | buffer.append(", "); //$NON-NLS-1$ |
| 647 | } |
| 648 | } |
| 649 | buffer.append('}'); |
| 650 | return buffer.toString(); |
| 651 | } |
| 652 | |
| 653 | /// Returns a collection of the values contained in this map. The collection |
| 654 | /// is backed by this map so changes to one are reflected by the other. The |