| 1148 | /// |
| 1149 | /// - #elements |
| 1150 | @Override |
| 1151 | public synchronized String toString() { |
| 1152 | if (elementCount == 0) { |
| 1153 | return "[]"; //$NON-NLS-1$ |
| 1154 | } |
| 1155 | int length = elementCount - 1; |
| 1156 | StringBuffer buffer = new StringBuffer(elementCount * 16); |
| 1157 | buffer.append('['); |
| 1158 | for (int i = 0; i < length; i++) { |
| 1159 | if (elementData[i] == this) { |
| 1160 | buffer.append("(this Collection)"); //$NON-NLS-1$ |
| 1161 | } else { |
| 1162 | buffer.append(elementData[i]); |
| 1163 | } |
| 1164 | buffer.append(", "); //$NON-NLS-1$ |
| 1165 | } |
| 1166 | if (elementData[length] == this) { |
| 1167 | buffer.append("(this Collection)"); //$NON-NLS-1$ |
| 1168 | } else { |
| 1169 | buffer.append(elementData[length]); |
| 1170 | } |
| 1171 | buffer.append(']'); |
| 1172 | return buffer.toString(); |
| 1173 | } |
| 1174 | |
| 1175 | /// Sets the capacity of this vector to be the same as the size. |
| 1176 | /// |