--- old/src/share/classes/java/lang/String.java 2012-01-23 00:18:55.000000000 -0800
+++ new/src/share/classes/java/lang/String.java 2012-01-23 00:18:55.000000000 -0800
@@ -39,8 +39,8 @@
import java.util.regex.PatternSyntaxException;
/**
- * The String
class represents character strings. All
- * string literals in Java programs, such as "abc"
, are
+ * The {@code String} class represents character strings. All
+ * string literals in Java programs, such as {@code "abc"}, are
* implemented as instances of this class.
*
* Strings are constant; their values cannot be changed after they @@ -63,7 +63,7 @@ * String d = cde.substring(1, 2); * *
- * The class String
includes methods for examining
+ * The class {@code String} includes methods for examining
* individual characters of the sequence, for comparing strings, for
* searching strings, for extracting substrings, and for creating a
* copy of a string with all characters translated to uppercase or to
@@ -73,10 +73,10 @@
* The Java language provides special support for the string
* concatenation operator ( + ), and for conversion of
* other objects to strings. String concatenation is implemented
- * through the StringBuilder
(or StringBuffer
)
- * class and its append
method.
+ * through the {@code StringBuilder}(or {@code StringBuffer})
+ * class and its {@code append} method.
* String conversions are implemented through the method
- * toString
, defined by Object
and
+ * {@code toString}, defined by {@code Object} and
* inherited by all classes in Java. For additional information on
* string concatenation and conversion, see Gosling, Joy, and Steele,
* The Java Language Specification.
@@ -85,16 +85,16 @@
* or method in this class will cause a {@link NullPointerException} to be
* thrown.
*
- *
A String
represents a string in the UTF-16 format
+ *
A {@code String} represents a string in the UTF-16 format
* in which supplementary characters are represented by surrogate
* pairs (see the section Unicode
- * Character Representations in the Character
class for
+ * Character Representations in the {@code Character} class for
* more information).
- * Index values refer to char
code units, so a supplementary
- * character uses two positions in a String
.
- *
The String
class provides methods for dealing with
+ * Index values refer to {@code char} code units, so a supplementary
+ * character uses two positions in a {@code String}.
+ *
The {@code String} class provides methods for dealing with
* Unicode code points (i.e., characters), in addition to those for
- * dealing with Unicode code units (i.e., char
values).
+ * dealing with Unicode code units (i.e., {@code char} values).
*
* @author Lee Boynton
* @author Arthur van Hoff
@@ -131,9 +131,9 @@
* A String instance is written initially into an ObjectOutputStream in the
* following format:
*
- * TC_STRING
(utf String)
+ * {@code TC_STRING} (utf String)
*
- * The String is written by method DataOutput.writeUTF
.
+ * The String is written by method {@code DataOutput.writeUTF}.
* A new handle is generated to refer to all future references to the
* string instance within the stream.
*/
@@ -673,20 +673,20 @@
}
/**
- * Returns the char
value at the
- * specified index. An index ranges from 0
to
- * length() - 1
. The first char
value of the sequence
- * is at index 0
, the next at index 1
,
+ * Returns the {@code char} value at the
+ * specified index. An index ranges from {@code 0} to
+ * {@code length() - 1}. The first {@code char} value of the sequence
+ * is at index {@code 0}, the next at index {@code 1},
* and so on, as for array indexing.
*
- * If the char
value specified by the index is a
+ *
If the {@code char} value specified by the index is a
* surrogate, the surrogate
* value is returned.
*
- * @param index the index of the char
value.
- * @return the char
value at the specified index of this string.
- * The first char
value is at index 0
.
- * @exception IndexOutOfBoundsException if the index
+ * @param index the index of the {@code char} value.
+ * @return the {@code char} value at the specified index of this string.
+ * The first {@code char} value is at index {@code 0}.
+ * @exception IndexOutOfBoundsException if the {@code index}
* argument is negative or not less than the length of this
* string.
*/
@@ -699,22 +699,22 @@
/**
* Returns the character (Unicode code point) at the specified
- * index. The index refers to char
values
- * (Unicode code units) and ranges from 0
to
- * {@link #length()} - 1
.
+ * index. The index refers to {@code char} values
+ * (Unicode code units) and ranges from {@code 0} to
+ * {@link #length()}{@code - 1}.
*
- *
If the char
value specified at the given index
+ *
If the {@code char} value specified at the given index
* is in the high-surrogate range, the following index is less
- * than the length of this String
, and the
- * char
value at the following index is in the
+ * than the length of this {@code String}, and the
+ * {@code char} value at the following index is in the
* low-surrogate range, then the supplementary code point
* corresponding to this surrogate pair is returned. Otherwise,
- * the char
value at the given index is returned.
+ * the {@code char} value at the given index is returned.
*
- * @param index the index to the char
values
+ * @param index the index to the {@code char} values
* @return the code point value of the character at the
- * index
- * @exception IndexOutOfBoundsException if the index
+ * {@code index}
+ * @exception IndexOutOfBoundsException if the {@code index}
* argument is negative or not less than the length of this
* string.
* @since 1.5
@@ -728,22 +728,22 @@
/**
* Returns the character (Unicode code point) before the specified
- * index. The index refers to char
values
- * (Unicode code units) and ranges from 1
to {@link
+ * index. The index refers to {@code char} values
+ * (Unicode code units) and ranges from {@code 1} to {@link
* CharSequence#length() length}.
*
- *
If the char
value at (index - 1)
- * is in the low-surrogate range, (index - 2)
is not
- * negative, and the char
value at (index -
- * 2)
is in the high-surrogate range, then the
+ *
If the {@code char} value at {@code (index - 1)}
+ * is in the low-surrogate range, {@code (index - 2)} is not
+ * negative, and the {@code char} value at {@code (index -
+ * 2)} is in the high-surrogate range, then the
* supplementary code point value of the surrogate pair is
- * returned. If the char
value at index -
- * 1
is an unpaired low-surrogate or a high-surrogate, the
+ * returned. If the {@code char} value at {@code index -
+ * 1} is an unpaired low-surrogate or a high-surrogate, the
* surrogate value is returned.
*
* @param index the index following the code point that should be returned
* @return the Unicode code point value before the given index.
- * @exception IndexOutOfBoundsException if the index
+ * @exception IndexOutOfBoundsException if the {@code index}
* argument is less than 1 or greater than the length
* of this string.
* @since 1.5
@@ -758,23 +758,23 @@
/**
* Returns the number of Unicode code points in the specified text
- * range of this String
. The text range begins at the
- * specified beginIndex
and extends to the
- * char
at index endIndex - 1
. Thus the
- * length (in char
s) of the text range is
- * endIndex-beginIndex
. Unpaired surrogates within
+ * range of this {@code String}. The text range begins at the
+ * specified {@code beginIndex} and extends to the
+ * {@code char} at index {@code endIndex - 1}. Thus the
+ * length (in {@code char}s) of the text range is
+ * {@code endIndex-beginIndex}. Unpaired surrogates within
* the text range count as one code point each.
*
- * @param beginIndex the index to the first char
of
+ * @param beginIndex the index to the first {@code char} of
* the text range.
- * @param endIndex the index after the last char
of
+ * @param endIndex the index after the last {@code char} of
* the text range.
* @return the number of Unicode code points in the specified text
* range
* @exception IndexOutOfBoundsException if the
- * beginIndex
is negative, or endIndex
- * is larger than the length of this String
, or
- * beginIndex
is larger than endIndex
.
+ * {@code beginIndex} is negative, or {@code endIndex}
+ * is larger than the length of this {@code String}, or
+ * {@code beginIndex} is larger than {@code endIndex}.
* @since 1.5
*/
public int codePointCount(int beginIndex, int endIndex) {
@@ -785,23 +785,23 @@
}
/**
- * Returns the index within this String
that is
- * offset from the given index
by
- * codePointOffset
code points. Unpaired surrogates
- * within the text range given by index
and
- * codePointOffset
count as one code point each.
+ * Returns the index within this {@code String} that is
+ * offset from the given {@code index} by
+ * {@code codePointOffset} code points. Unpaired surrogates
+ * within the text range given by {@code index} and
+ * {@code codePointOffset} count as one code point each.
*
* @param index the index to be offset
* @param codePointOffset the offset in code points
- * @return the index within this String
- * @exception IndexOutOfBoundsException if index
+ * @return the index within this {@code String}
+ * @exception IndexOutOfBoundsException if {@code index}
* is negative or larger then the length of this
- * String
, or if codePointOffset
is positive
- * and the substring starting with index
has fewer
- * than codePointOffset
code points,
- * or if codePointOffset
is negative and the substring
- * before index
has fewer than the absolute value
- * of codePointOffset
code points.
+ * {@code String}, or if {@code codePointOffset} is positive
+ * and the substring starting with {@code index} has fewer
+ * than {@code codePointOffset} code points,
+ * or if {@code codePointOffset} is negative and the substring
+ * before {@code index} has fewer than the absolute value
+ * of {@code codePointOffset} code points.
* @since 1.5
*/
public int offsetByCodePoints(int index, int codePointOffset) {
@@ -824,11 +824,11 @@
* Copies characters from this string into the destination character
* array.
*
- * The first character to be copied is at index srcBegin
;
- * the last character to be copied is at index srcEnd-1
+ * The first character to be copied is at index {@code srcBegin};
+ * the last character to be copied is at index {@code srcEnd-1}
* (thus the total number of characters to be copied is
- * srcEnd-srcBegin
). The characters are copied into the
- * subarray of dst
starting at index dstBegin
+ * {@code srcEnd-srcBegin}). The characters are copied into the
+ * subarray of {@code dst} starting at index {@code dstBegin}
* and ending at index:
*
* * - * @param ignoreCase if* dstbegin + (srcEnd-srcBegin) - 1 @@ -842,13 +842,13 @@ * @param dstBegin the start offset in the destination array. * @exception IndexOutOfBoundsException If any of the following * is true: - **/ public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) { if (srcBegin < 0) { @@ -1135,14 +1135,14 @@ * Compares two strings lexicographically. * The comparison is based on the Unicode value of each character in * the strings. The character sequence represented by this - *
srcBegin
is negative. - *srcBegin
is greater thansrcEnd
- *srcEnd
is greater than the length of this + *+ *
- {@code srcBegin} is negative. + *
- {@code srcBegin} is greater than {@code srcEnd} + *
- {@code srcEnd} is greater than the length of this * string - *
dstBegin
is negative - *dstBegin+(srcEnd-srcBegin)
is larger than - *dst.length
- {@code dstBegin} is negative + *
- {@code dstBegin+(srcEnd-srcBegin)} is larger than + * {@code dst.length}
String
object is compared lexicographically to the + * {@code String} object is compared lexicographically to the * character sequence represented by the argument string. The result is - * a negative integer if thisString
object + * a negative integer if this {@code String} object * lexicographically precedes the argument string. The result is a - * positive integer if thisString
object lexicographically + * positive integer if this {@code String} object lexicographically * follows the argument string. The result is zero if the strings - * are equal;compareTo
returns0
exactly when - * the {@link #equals(Object)} method would returntrue
. + * are equal; {@code compareTo} returns {@code 0} exactly when + * the {@link #equals(Object)} method would return {@code true}. ** This is the definition of lexicographic ordering. If two strings are * different, then either they have different characters at some index @@ -1151,25 +1151,25 @@ * positions, let k be the smallest such index; then the string * whose character at position k has the smaller value, as * determined by using the < operator, lexicographically precedes the - * other string. In this case,
compareTo
returns the - * difference of the two character values at positionk
in + * other string. In this case, {@code compareTo} returns the + * difference of the two character values at position {@code k} in * the two string -- that is, the value: ** If there is no index position at which they differ, then the shorter * string lexicographically precedes the longer string. In this case, - ** this.charAt(k)-anotherString.charAt(k) *compareTo
returns the difference of the lengths of the + * {@code compareTo} returns the difference of the lengths of the * strings -- that is, the value: ** - * @param anotherString the* this.length()-anotherString.length() *String
to be compared. - * @return the value0
if the argument string is equal to - * this string; a value less than0
if this string + * @param anotherString the {@code String} to be compared. + * @return the value {@code 0} if the argument string is equal to + * this string; a value less than {@code 0} if this string * is lexicographically less than the string argument; and a - * value greater than0
if this string is + * value greater than {@code 0} if this string is * lexicographically greater than the string argument. */ public int compareTo(String anotherString) { @@ -1205,8 +1205,8 @@ } /** - * A Comparator that ordersString
objects as by - *compareToIgnoreCase
. This comparator is serializable. + * A Comparator that orders {@code String} objects as by + * {@code compareToIgnoreCase}. This comparator is serializable. ** Note that this Comparator does not take locale into account, * and will result in an unsatisfactory ordering for certain locales. @@ -1253,9 +1253,9 @@ /** * Compares two strings lexicographically, ignoring case * differences. This method returns an integer whose sign is that of - * calling
compareTo
with normalized versions of the strings + * calling {@code compareTo} with normalized versions of the strings * where case differences have been eliminated by calling - *Character.toLowerCase(Character.toUpperCase(character))
on + * {@code Character.toLowerCase(Character.toUpperCase(character))} on * each character. ** Note that this method does not take locale into account, @@ -1263,7 +1263,7 @@ * The java.text package provides collators to allow * locale-sensitive ordering. * - * @param str the
String
to be compared. + * @param str the {@code String} to be compared. * @return a negative integer, zero, or a positive integer as the * specified String is greater than, equal to, or less * than this String, ignoring case considerations. @@ -1301,9 +1301,9 @@ * @param ooffset the starting offset of the subregion in the string * argument. * @param len the number of characters to compare. - * @returntrue
if the specified subregion of this string + * @return {@code true} if the specified subregion of this string * exactly matches the specified subregion of the string argument; - *false
otherwise. + * {@code false} otherwise. */ public boolean regionMatches(int toffset, String other, int ooffset, int len) { @@ -1360,7 +1360,7 @@ *
true
, ignore case when comparing
+ * @param ignoreCase if {@code true}, ignore case when comparing
* characters.
* @param toffset the starting offset of the subregion in this
* string.
@@ -1368,10 +1368,10 @@
* @param ooffset the starting offset of the subregion in the string
* argument.
* @param len the number of characters to compare.
- * @return true
if the specified subregion of this string
+ * @return {@code true} if the specified subregion of this string
* matches the specified subregion of the string argument;
- * false
otherwise. Whether the matching is exact
- * or case insensitive depends on the ignoreCase
+ * {@code false} otherwise. Whether the matching is exact
+ * or case insensitive depends on the {@code ignoreCase}
* argument.
*/
public boolean regionMatches(boolean ignoreCase, int toffset,
@@ -1420,12 +1420,12 @@
*
* @param prefix the prefix.
* @param toffset where to begin looking in this string.
- * @return true
if the character sequence represented by the
+ * @return {@code true} if the character sequence represented by the
* argument is a prefix of the substring of this object starting
- * at index toffset
; false
otherwise.
- * The result is false
if toffset
is
+ * at index {@code toffset}; {@code false} otherwise.
+ * The result is {@code false} if {@code toffset} is
* negative or greater than the length of this
- * String
object; otherwise the result is the same
+ * {@code String} object; otherwise the result is the same
* as the result of the expression
* * this.substring(toffset).startsWith(prefix) @@ -1453,12 +1453,12 @@ * Tests if this string starts with the specified prefix. * * @param prefix the prefix. - * @returntrue
if the character sequence represented by the + * @return {@code true} if the character sequence represented by the * argument is a prefix of the character sequence represented by - * this string;false
otherwise. - * Note also thattrue
will be returned if the + * this string; {@code false} otherwise. + * Note also that {@code true} will be returned if the * argument is an empty string or is equal to this - *String
object as determined by the + * {@code String} object as determined by the * {@link #equals(Object)} method. * @since 1. 0 */ @@ -1470,11 +1470,11 @@ * Tests if this string ends with the specified suffix. * * @param suffix the suffix. - * @returntrue
if the character sequence represented by the + * @return {@code true} if the character sequence represented by the * argument is a suffix of the character sequence represented by - * this object;false
otherwise. Note that the - * result will betrue
if the argument is the - * empty string or is equal to thisString
object + * this object; {@code false} otherwise. Note that the + * result will be {@code true} if the argument is the + * empty string or is equal to this {@code String} object * as determined by the {@link #equals(Object)} method. */ public boolean endsWith(String suffix) { @@ -1483,13 +1483,13 @@ /** * Returns a hash code for this string. The hash code for a - *String
object is computed as + * {@code String} object is computed as *- * using* s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] *int
arithmetic, wheres[i]
is the - * ith character of the string,n
is the length of - * the string, and^
indicates exponentiation. + * using {@code int} arithmetic, where {@code s[i]} is the + * ith character of the string, {@code n} is the length of + * the string, and {@code ^} indicates exponentiation. * (The hash value of the empty string is zero.) * * @return a hash code value for this object. @@ -1512,26 +1512,26 @@ /** * Returns the index within this string of the first occurrence of * the specified character. If a character with value - *ch
occurs in the character sequence represented by - * thisString
object, then the index (in Unicode + * {@code ch} occurs in the character sequence represented by + * this {@code String} object, then the index (in Unicode * code units) of the first such occurrence is returned. For - * values ofch
in the range from 0 to 0xFFFF + * values of {@code ch} in the range from 0 to 0xFFFF * (inclusive), this is the smallest value k such that: *- * is true. For other values of* this.charAt(k) == ch *ch
, it is the + * is true. For other values of {@code ch}, it is the * smallest value k such that: ** is true. In either case, if no such character occurs in this - * string, then* this.codePointAt(k) == ch *-1
is returned. + * string, then {@code -1} is returned. * * @param ch a character (Unicode code point). * @return the index of the first occurrence of the character in the * character sequence represented by this object, or - *-1
if the character does not occur. + * {@code -1} if the character does not occur. */ public int indexOf(int ch) { return indexOf(ch, 0); @@ -1541,39 +1541,39 @@ * Returns the index within this string of the first occurrence of the * specified character, starting the search at the specified index. *- * If a character with value
ch
occurs in the - * character sequence represented by thisString
- * object at an index no smaller thanfromIndex
, then + * If a character with value {@code ch} occurs in the + * character sequence represented by this {@code String} + * object at an index no smaller than {@code fromIndex}, then * the index of the first such occurrence is returned. For values - * ofch
in the range from 0 to 0xFFFF (inclusive), + * of {@code ch} in the range from 0 to 0xFFFF (inclusive), * this is the smallest value k such that: *- * is true. For other values of* (this.charAt(k) == ch) && (k >= fromIndex) *ch
, it is the + * is true. For other values of {@code ch}, it is the * smallest value k such that: ** is true. In either case, if no such character occurs in this - * string at or after position* (this.codePointAt(k) == ch) && (k >= fromIndex) *fromIndex
, then - *-1
is returned. + * string at or after position {@code fromIndex}, then + * {@code -1} is returned. * *- * There is no restriction on the value of
fromIndex
. If it + * There is no restriction on the value of {@code fromIndex}. If it * is negative, it has the same effect as if it were zero: this entire * string may be searched. If it is greater than the length of this * string, it has the same effect as if it were equal to the length of - * this string:-1
is returned. + * this string: {@code -1} is returned. * - *All indices are specified in
char
values + *All indices are specified in {@code char} values * (Unicode code units). * * @param ch a character (Unicode code point). * @param fromIndex the index to start the search from. * @return the index of the first occurrence of the character in the * character sequence represented by this object that is greater - * than or equal to
fromIndex
, or-1
+ * than or equal to {@code fromIndex}, or {@code -1} * if the character does not occur. */ public int indexOf(int ch, int fromIndex) { @@ -1622,26 +1622,26 @@ /** * Returns the index within this string of the last occurrence of - * the specified character. For values ofch
in the + * the specified character. For values of {@code ch} in the * range from 0 to 0xFFFF (inclusive), the index (in Unicode code * units) returned is the largest value k such that: *- * is true. For other values of* this.charAt(k) == ch *ch
, it is the + * is true. For other values of {@code ch}, it is the * largest value k such that: ** is true. In either case, if no such character occurs in this - * string, then* this.codePointAt(k) == ch *-1
is returned. The - *String
is searched backwards starting at the last + * string, then {@code -1} is returned. The + * {@code String} is searched backwards starting at the last * character. * * @param ch a character (Unicode code point). * @return the index of the last occurrence of the character in the * character sequence represented by this object, or - *-1
if the character does not occur. + * {@code -1} if the character does not occur. */ public int lastIndexOf(int ch) { return lastIndexOf(ch, count - 1); @@ -1650,27 +1650,27 @@ /** * Returns the index within this string of the last occurrence of * the specified character, searching backward starting at the - * specified index. For values ofch
in the range + * specified index. For values of {@code ch} in the range * from 0 to 0xFFFF (inclusive), the index returned is the largest * value k such that: *- * is true. For other values of* (this.charAt(k) == ch) && (k <= fromIndex) *ch
, it is the + * is true. For other values of {@code ch}, it is the * largest value k such that: ** is true. In either case, if no such character occurs in this - * string at or before position* (this.codePointAt(k) == ch) && (k <= fromIndex) *fromIndex
, then - *-1
is returned. + * string at or before position {@code fromIndex}, then + * {@code -1} is returned. * - *All indices are specified in
char
values + *All indices are specified in {@code char} values * (Unicode code units). * * @param ch a character (Unicode code point). * @param fromIndex the index to start the search from. There is no - * restriction on the value of
fromIndex
. If it is + * restriction on the value of {@code fromIndex}. If it is * greater than or equal to the length of this string, it has * the same effect as if it were equal to one less than the * length of this string: this entire string may be searched. @@ -1678,7 +1678,7 @@ * -1 is returned. * @return the index of the last occurrence of the character in the * character sequence represented by this object that is less - * than or equal tofromIndex
, or-1
+ * than or equal to {@code fromIndex}, or {@code -1} * if the character does not occur before that point. */ public int lastIndexOf(int ch, int fromIndex) { @@ -1921,8 +1921,8 @@ * @param beginIndex the beginning index, inclusive. * @return the specified substring. * @exception IndexOutOfBoundsException if - *beginIndex
is negative or larger than the - * length of thisString
object. + * {@code beginIndex} is negative or larger than the + * length of this {@code String} object. */ public String substring(int beginIndex) { return substring(beginIndex, count); @@ -1930,9 +1930,9 @@ /** * Returns a new string that is a substring of this string. The - * substring begins at the specifiedbeginIndex
and - * extends to the character at indexendIndex - 1
. - * Thus the length of the substring isendIndex-beginIndex
. + * substring begins at the specified {@code beginIndex} and + * extends to the character at index {@code endIndex - 1}. + * Thus the length of the substring is {@code endIndex-beginIndex}. ** Examples: *
@@ -1944,11 +1944,11 @@ * @param endIndex the ending index, exclusive. * @return the specified substring. * @exception IndexOutOfBoundsException if the - *beginIndex
is negative, or - *endIndex
is larger than the length of - * thisString
object, or - *beginIndex
is larger than - *endIndex
. + * {@code beginIndex} is negative, or + * {@code endIndex} is larger than the length of + * this {@code String} object, or + * {@code beginIndex} is larger than + * {@code endIndex}. */ public String substring(int beginIndex, int endIndex) { if (beginIndex < 0) { @@ -1999,11 +1999,11 @@ /** * Concatenates the specified string to the end of this string. *- * If the length of the argument string is
0
, then this - *String
object is returned. Otherwise, a new - *String
object is created, representing a character + * If the length of the argument string is {@code 0}, then this + * {@code String} object is returned. Otherwise, a new + * {@code String} object is created, representing a character * sequence that is the concatenation of the character sequence - * represented by thisString
object and the character + * represented by this {@code String} object and the character * sequence represented by the argument string.* Examples: *
* - * @param str the@@ -2011,8 +2011,8 @@ * "to".concat("get").concat("her") returns "together" *String
that is concatenated to the end - * of thisString
. + * @param str the {@code String} that is concatenated to the end + * of this {@code String}. * @return a string that represents the concatenation of this object's * characters followed by the string argument's characters. */ @@ -2029,16 +2029,16 @@ /** * Returns a new string resulting from replacing all occurrences of - *oldChar
in this string withnewChar
. + * {@code oldChar} in this string with {@code newChar}. *- * If the character
oldChar
does not occur in the - * character sequence represented by thisString
object, - * then a reference to thisString
object is returned. - * Otherwise, a newString
object is created that + * If the character {@code oldChar} does not occur in the + * character sequence represented by this {@code String} object, + * then a reference to this {@code String} object is returned. + * Otherwise, a new {@code String} object is created that * represents a character sequence identical to the character sequence - * represented by thisString
object, except that every - * occurrence ofoldChar
is replaced by an occurrence - * ofnewChar
. + * represented by this {@code String} object, except that every + * occurrence of {@code oldChar} is replaced by an occurrence + * of {@code newChar}. ** Examples: *
@@ -2054,7 +2054,7 @@ * @param oldChar the old character. * @param newChar the new character. * @return a string derived from this string by replacing every - * occurrence ofoldChar
withnewChar
. + * occurrence of {@code oldChar} with {@code newChar}. */ public String replace(char oldChar, char newChar) { if (oldChar != newChar) { @@ -2119,8 +2119,8 @@ * sequence of char values. * * @param s the sequence to search for - * @return true if this string containss
, false otherwise - * @throws NullPointerException ifs
isnull
+ * @return true if this string contains {@code s}, false otherwise + * @throws NullPointerException if {@code s} is {@code null} * @since 1.5 */ public boolean contains(CharSequence s) { @@ -2223,8 +2223,8 @@ * @param target The sequence of char values to be replaced * @param replacement The replacement sequence of char values * @return The resulting string - * @throws NullPointerException iftarget
or - *replacement
isnull
. + * @throws NullPointerException if {@code target} or + * {@code replacement} is {@code null}. * @since 1.5 */ public String replace(CharSequence target, CharSequence replacement) { @@ -2407,11 +2407,11 @@ } /** - * Converts all of the characters in thisString
to lower - * case using the rules of the givenLocale
. Case mapping is based + * Converts all of the characters in this {@code String} to lower + * case using the rules of the given {@code Locale}. Case mapping is based * on the Unicode Standard version specified by the {@link java.lang.Character Character} * class. Since case mappings are not always 1:1 char mappings, the resulting - *String
may be a different length than the originalString
. + * {@code String} may be a different length than the original {@code String}. ** Examples of lowercase mappings are in the following table: *
@@ -2452,7 +2452,7 @@ *
* * @param locale use the case transformation rules for this locale - * @return theString
, converted to lowercase. + * @return the {@code String}, converted to lowercase. * @see java.lang.String#toLowerCase() * @see java.lang.String#toUpperCase() * @see java.lang.String#toUpperCase(Locale) @@ -2553,22 +2553,22 @@ } /** - * Converts all of the characters in thisString
to lower + * Converts all of the characters in this {@code String} to lower * case using the rules of the default locale. This is equivalent to calling - *toLowerCase(Locale.getDefault())
. + * {@code toLowerCase(Locale.getDefault())}. ** Note: This method is locale sensitive, and may produce unexpected * results if used for strings that are intended to be interpreted locale * independently. * Examples are programming language identifiers, protocol keys, and HTML * tags. - * For instance,
"TITLE".toLowerCase()
in a Turkish locale - * returns"t\u005Cu0131tle"
, where '\u005Cu0131' is the + * For instance, {@code "TITLE".toLowerCase()} in a Turkish locale + * returns {@code "t\u005Cu0131tle"}, where '\u005Cu0131' is the * LATIN SMALL LETTER DOTLESS I character. * To obtain correct results for locale insensitive strings, use - *toLowerCase(Locale.ENGLISH)
. + * {@code toLowerCase(Locale.ENGLISH)}. *- * @return the
String
, converted to lowercase. + * @return the {@code String}, converted to lowercase. * @see java.lang.String#toLowerCase(Locale) */ public String toLowerCase() { @@ -2576,11 +2576,11 @@ } /** - * Converts all of the characters in thisString
to upper - * case using the rules of the givenLocale
. Case mapping is based + * Converts all of the characters in this {@code String} to upper + * case using the rules of the given {@code Locale}. Case mapping is based * on the Unicode Standard version specified by the {@link java.lang.Character Character} * class. Since case mappings are not always 1:1 char mappings, the resulting - *String
may be a different length than the originalString
. + * {@code String} may be a different length than the original {@code String}. ** Examples of locale-sensitive and 1:M case mappings are in the following table. *
@@ -2617,7 +2617,7 @@ * * * @param locale use the case transformation rules for this locale - * @return the
String
, converted to uppercase. + * @return the {@code String}, converted to uppercase. * @see java.lang.String#toUpperCase() * @see java.lang.String#toLowerCase() * @see java.lang.String#toLowerCase(Locale) @@ -2716,22 +2716,22 @@ } /** - * Converts all of the characters in thisString
to upper + * Converts all of the characters in this {@code String} to upper * case using the rules of the default locale. This method is equivalent to - *toUpperCase(Locale.getDefault())
. + * {@code toUpperCase(Locale.getDefault())}. ** Note: This method is locale sensitive, and may produce unexpected * results if used for strings that are intended to be interpreted locale * independently. * Examples are programming language identifiers, protocol keys, and HTML * tags. - * For instance,
"title".toUpperCase()
in a Turkish locale - * returns"T\u005Cu0130TLE"
, where '\u005Cu0130' is the + * For instance, {@code "title".toUpperCase()} in a Turkish locale + * returns {@code "T\u005Cu0130TLE"}, where '\u005Cu0130' is the * LATIN CAPITAL LETTER I WITH DOT ABOVE character. * To obtain correct results for locale insensitive strings, use - *toUpperCase(Locale.ENGLISH)
. + * {@code toUpperCase(Locale.ENGLISH)}. *- * @return the
String
, converted to uppercase. + * @return the {@code String}, converted to uppercase. * @see java.lang.String#toUpperCase(Locale) */ public String toUpperCase() { @@ -2742,21 +2742,21 @@ * Returns a copy of the string, with leading and trailing whitespace * omitted. *- * If this
String
object represents an empty character + * If this {@code String} object represents an empty character * sequence, or the first and last characters of character sequence - * represented by thisString
object both have codes - * greater than'\u0020'
(the space character), then a - * reference to thisString
object is returned. + * represented by this {@code String} object both have codes + * greater than {@code '\u005Cu0020'} (the space character), then a + * reference to this {@code String} object is returned. ** Otherwise, if there is no character with a code greater than - *
'\u0020'
in the string, then a new - *String
object representing an empty string is created + * {@code '\u005Cu0020'} in the string, then a new + * {@code String} object representing an empty string is created * and returned. ** Otherwise, let k be the index of the first character in the - * string whose code is greater than
'\u0020'
, and let + * string whose code is greater than {@code '\u005Cu0020'}, and let * m be the index of the last character in the string whose code - * is greater than'\u0020'
. A newString
+ * is greater than {@code '\u005Cu0020'}. A new {@code String} * object is created, representing the substring of this string that * begins with the character at index k and ends with the * character at index m-that is, the result of @@ -2893,12 +2893,12 @@ } /** - * Returns the string representation of theObject
argument. + * Returns the string representation of the {@code Object} argument. * - * @param obj anObject
. - * @return if the argument isnull
, then a string equal to - *"null"
; otherwise, the value of - *obj.toString()
is returned. + * @param obj an {@code Object}. + * @return if the argument is {@code null}, then a string equal to + * {@code "null"}; otherwise, the value of + * {@code obj.toString()} is returned. * @see java.lang.Object#toString() */ public static String valueOf(Object obj) { @@ -2906,12 +2906,12 @@ } /** - * Returns the string representation of thechar
array + * Returns the string representation of the {@code char} array * argument. The contents of the character array are copied; subsequent * modification of the character array does not affect the newly * created string. * - * @param data achar
array. + * @param data a {@code char} array. * @return a newly allocated string representing the same sequence of * characters contained in the character array argument. */ @@ -2921,24 +2921,24 @@ /** * Returns the string representation of a specific subarray of the - *char
array argument. + * {@code char} array argument. *- * The
offset
argument is the index of the first - * character of the subarray. Thecount
argument + * The {@code offset} argument is the index of the first + * character of the subarray. The {@code count} argument * specifies the length of the subarray. The contents of the subarray * are copied; subsequent modification of the character array does not * affect the newly created string. * * @param data the character array. * @param offset the initial offset into the value of the - *String
. - * @param count the length of the value of theString
. + * {@code String}. + * @param count the length of the value of the {@code String}. * @return a string representing the sequence of characters contained * in the subarray of the character array argument. - * @exception IndexOutOfBoundsException ifoffset
is - * negative, orcount
is negative, or - *offset+count
is larger than - *data.length
. + * @exception IndexOutOfBoundsException if {@code offset} is + * negative, or {@code count} is negative, or + * {@code offset+count} is larger than + * {@code data.length}. */ public static String valueOf(char data[], int offset, int count) { return new String(data, offset, count); @@ -2951,7 +2951,7 @@ * @param data the character array. * @param offset initial offset of the subarray. * @param count length of the subarray. - * @return aString
that contains the characters of the + * @return a {@code String} that contains the characters of the * specified subarray of the character array. */ public static String copyValueOf(char data[], int offset, int count) { @@ -2964,7 +2964,7 @@ * array specified. * * @param data the character array. - * @return aString
that contains the characters of the + * @return a {@code String} that contains the characters of the * character array. */ public static String copyValueOf(char data[]) { @@ -2972,24 +2972,24 @@ } /** - * Returns the string representation of theboolean
argument. + * Returns the string representation of the {@code boolean} argument. * - * @param b aboolean
. - * @return if the argument istrue
, a string equal to - *"true"
is returned; otherwise, a string equal to - *"false"
is returned. + * @param b a {@code boolean}. + * @return if the argument is {@code true}, a string equal to + * {@code "true"} is returned; otherwise, a string equal to + * {@code "false"} is returned. */ public static String valueOf(boolean b) { return b ? "true" : "false"; } /** - * Returns the string representation of thechar
+ * Returns the string representation of the {@code char} * argument. * - * @param c achar
. - * @return a string of length1
containing - * as its single character the argumentc
. + * @param c a {@code char}. + * @return a string of length {@code 1} containing + * as its single character the argument {@code c}. */ public static String valueOf(char c) { char data[] = {c}; @@ -2997,13 +2997,13 @@ } /** - * Returns the string representation of theint
argument. + * Returns the string representation of the {@code int} argument. ** The representation is exactly the one returned by the - *
Integer.toString
method of one argument. + * {@code Integer.toString} method of one argument. * - * @param i anint
. - * @return a string representation of theint
argument. + * @param i an {@code int}. + * @return a string representation of the {@code int} argument. * @see java.lang.Integer#toString(int, int) */ public static String valueOf(int i) { @@ -3011,13 +3011,13 @@ } /** - * Returns the string representation of thelong
argument. + * Returns the string representation of the {@code long} argument. ** The representation is exactly the one returned by the - *
Long.toString
method of one argument. + * {@code Long.toString} method of one argument. * - * @param l along
. - * @return a string representation of thelong
argument. + * @param l a {@code long}. + * @return a string representation of the {@code long} argument. * @see java.lang.Long#toString(long) */ public static String valueOf(long l) { @@ -3025,13 +3025,13 @@ } /** - * Returns the string representation of thefloat
argument. + * Returns the string representation of the {@code float} argument. ** The representation is exactly the one returned by the - *
Float.toString
method of one argument. + * {@code Float.toString} method of one argument. * - * @param f afloat
. - * @return a string representation of thefloat
argument. + * @param f a {@code float}. + * @return a string representation of the {@code float} argument. * @see java.lang.Float#toString(float) */ public static String valueOf(float f) { @@ -3039,13 +3039,13 @@ } /** - * Returns the string representation of thedouble
argument. + * Returns the string representation of the {@code double} argument. ** The representation is exactly the one returned by the - *
Double.toString
method of one argument. + * {@code Double.toString} method of one argument. * - * @param d adouble
. - * @return a string representation of thedouble
argument. + * @param d a {@code double}. + * @return a string representation of the {@code double} argument. * @see java.lang.Double#toString(double) */ public static String valueOf(double d) { @@ -3056,17 +3056,17 @@ * Returns a canonical representation for the string object. ** A pool of strings, initially empty, is maintained privately by the - * class
String
. + * class {@code String}. ** When the intern method is invoked, if the pool already contains a - * string equal to this
String
object as determined by + * string equal to this {@code String} object as determined by * the {@link #equals(Object)} method, then the string from the pool is - * returned. Otherwise, thisString
object is added to the - * pool and a reference to thisString
object is returned. + * returned. Otherwise, this {@code String} object is added to the + * pool and a reference to this {@code String} object is returned. *- * It follows that for any two strings
s
andt
, - *s.intern() == t.intern()
istrue
- * if and only ifs.equals(t)
istrue
. + * It follows that for any two strings {@code s} and {@code t}, + * {@code s.intern() == t.intern()} is {@code true} + * if and only if {@code s.equals(t)} is {@code true}. ** All literal strings and string-valued constant expressions are * interned. String literals are defined in section 3.10.5 of the