1369 value[j] = temp2;
1370 value[n - j] = temp;
1371 }
1372 if (hasSurrogate) {
1373 // Reverse back all valid surrogate pairs
1374 for (int i = 0; i < count - 1; i++) {
1375 char c2 = value[i];
1376 if (Character.isLowSurrogate(c2)) {
1377 char c1 = value[i + 1];
1378 if (Character.isHighSurrogate(c1)) {
1379 value[i++] = c1;
1380 value[i] = c2;
1381 }
1382 }
1383 }
1384 }
1385 return this;
1386 }
1387
1388 /**
1389 * Returns a string representing the data in this sequence.
1390 * A new {@code String} object is allocated and initialized to
1391 * contain the character sequence currently represented by this
1392 * object. This {@code String} is then returned. Subsequent
1393 * changes to this sequence do not affect the contents of the
1394 * {@code String}.
1395 *
1396 * @return a string representation of this sequence of characters.
1397 */
1398 public abstract String toString();
1399
1400 /**
1401 * Needed by <tt>String</tt> for the contentEquals method.
1402 */
1403 final char[] getValue() {
1404 return value;
1405 }
1406
1407 }
|
1369 value[j] = temp2;
1370 value[n - j] = temp;
1371 }
1372 if (hasSurrogate) {
1373 // Reverse back all valid surrogate pairs
1374 for (int i = 0; i < count - 1; i++) {
1375 char c2 = value[i];
1376 if (Character.isLowSurrogate(c2)) {
1377 char c1 = value[i + 1];
1378 if (Character.isHighSurrogate(c1)) {
1379 value[i++] = c1;
1380 value[i] = c2;
1381 }
1382 }
1383 }
1384 }
1385 return this;
1386 }
1387
1388 /**
1389 * Appends {@code n} concatenated copies of the CharSequence to the
1390 * current value. If {@code n == 0}, then adds the empty string. If
1391 * @{code cs} is {@code null}, then adds {@code "null"} {@code n} times.
1392 *
1393 * @param n the number of copies of the CharSequence to concatenate
1394 * @param cs the CharSequence to concatenate (n times)
1395 * @return a reference to this object
1396 * @throws IllegalArgumentException if n < 0
1397 * @since 1.8
1398 */
1399 public AbstractStringBuilder append(int n, CharSequence cs) {
1400 if (n < 0) {
1401 throw new IllegalArgumentException("n < 0");
1402 }
1403
1404 for (int i = 0; i < n; i++) {
1405 append(cs);
1406 }
1407
1408 return this;
1409 }
1410
1411 /**
1412 * Returns a string representing the data in this sequence.
1413 * A new {@code String} object is allocated and initialized to
1414 * contain the character sequence currently represented by this
1415 * object. This {@code String} is then returned. Subsequent
1416 * changes to this sequence do not affect the contents of the
1417 * {@code String}.
1418 *
1419 * @return a string representation of this sequence of characters.
1420 */
1421 public abstract String toString();
1422
1423 /**
1424 * Needed by <tt>String</tt> for the contentEquals method.
1425 */
1426 final char[] getValue() {
1427 return value;
1428 }
1429
1430 }
|