Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
fd96bc14
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fd96bc14
编写于
12月 28, 2012
作者:
J
jgish
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8005118: Javadoc styles are inconsistent
Summary: use a common javadoc style in the String classes Reviewed-by: darcy
上级
245b51e4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
147 addition
and
141 deletion
+147
-141
src/share/classes/java/lang/AbstractStringBuilder.java
src/share/classes/java/lang/AbstractStringBuilder.java
+5
-5
src/share/classes/java/lang/String.java
src/share/classes/java/lang/String.java
+88
-82
src/share/classes/java/lang/StringBuffer.java
src/share/classes/java/lang/StringBuffer.java
+11
-11
src/share/classes/java/lang/StringBuilder.java
src/share/classes/java/lang/StringBuilder.java
+38
-38
src/share/classes/java/lang/StringIndexOutOfBoundsException.java
...re/classes/java/lang/StringIndexOutOfBoundsException.java
+5
-5
未找到文件。
src/share/classes/java/lang/AbstractStringBuilder.java
浏览文件 @
fd96bc14
...
@@ -860,9 +860,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -860,9 +860,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* @return the specified subsequence.
* @return the specified subsequence.
*
*
* @throws IndexOutOfBoundsException
* @throws IndexOutOfBoundsException
* if
<tt>start</tt> or <tt>end</tt>
are negative,
* if
{@code start} or {@code end}
are negative,
* if
<tt>end</tt> is greater than <tt>length()</tt>
,
* if
{@code end} is greater than {@code length()}
,
* or if
<tt>start</tt> is greater than <tt>end</tt>
* or if
{@code start} is greater than {@code end}
* @spec JSR-51
* @spec JSR-51
*/
*/
@Override
@Override
...
@@ -1292,7 +1292,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -1292,7 +1292,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
/**
/**
* Returns the index within this string of the first occurrence of the
* Returns the index within this string of the first occurrence of the
* specified substring, starting at the specified index. The integer
* specified substring, starting at the specified index. The integer
* returned is the smallest value
<tt>k</tt>
for which:
* returned is the smallest value
{@code k}
for which:
* <blockquote><pre>
* <blockquote><pre>
* k >= Math.min(fromIndex, str.length()) &&
* k >= Math.min(fromIndex, str.length()) &&
* this.toString().startsWith(str, k)
* this.toString().startsWith(str, k)
...
@@ -1418,7 +1418,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -1418,7 +1418,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
public
abstract
String
toString
();
public
abstract
String
toString
();
/**
/**
* Needed by
<tt>String</tt>
for the contentEquals method.
* Needed by
{@code String}
for the contentEquals method.
*/
*/
final
char
[]
getValue
()
{
final
char
[]
getValue
()
{
return
value
;
return
value
;
...
...
src/share/classes/java/lang/String.java
浏览文件 @
fd96bc14
...
@@ -615,10 +615,10 @@ public final class String
...
@@ -615,10 +615,10 @@ public final class String
}
}
/**
/**
* Returns
<tt>true</tt> if, and only if, {@link #length()} is <tt>0</tt>
.
* Returns
{@code true} if, and only if, {@link #length()} is {@code 0}
.
*
*
* @return
<tt>true</tt> if {@link #length()} is <tt>0</tt>
, otherwise
* @return
{@code true} if {@link #length()} is {@code 0}
, otherwise
*
<tt>false</tt>
*
{@code false}
*
*
* @since 1.6
* @since 1.6
*/
*/
...
@@ -1229,23 +1229,23 @@ public final class String
...
@@ -1229,23 +1229,23 @@ public final class String
/**
/**
* Tests if two string regions are equal.
* Tests if two string regions are equal.
* <p>
* <p>
* A substring of this
<tt>String</tt>
object is compared to a substring
* A substring of this
{@code String}
object is compared to a substring
* of the argument other. The result is true if these substrings
* of the argument other. The result is true if these substrings
* represent identical character sequences. The substring of this
* represent identical character sequences. The substring of this
*
<tt>String</tt> object to be compared begins at index <tt>toffset</tt>
*
{@code String} object to be compared begins at index {@code toffset}
* and has length
<tt>len</tt>
. The substring of other to be compared
* and has length
{@code len}
. The substring of other to be compared
* begins at index
<tt>ooffset</tt> and has length <tt>len</tt>
. The
* begins at index
{@code ooffset} and has length {@code len}
. The
* result is
<tt>false</tt>
if and only if at least one of the following
* result is
{@code false}
if and only if at least one of the following
* is true:
* is true:
* <ul><li>
<tt>toffset</tt>
is negative.
* <ul><li>
{@code toffset}
is negative.
* <li>
<tt>ooffset</tt>
is negative.
* <li>
{@code ooffset}
is negative.
* <li>
<tt>toffset+len</tt>
is greater than the length of this
* <li>
{@code toffset+len}
is greater than the length of this
*
<tt>String</tt>
object.
*
{@code String}
object.
* <li>
<tt>ooffset+len</tt>
is greater than the length of the other
* <li>
{@code ooffset+len}
is greater than the length of the other
* argument.
* argument.
* <li>There is some nonnegative integer <i>k</i> less than
<tt>len</tt>
* <li>There is some nonnegative integer <i>k</i> less than
{@code len}
* such that:
* such that:
* <
tt>this.charAt(toffset+<i>k</i>) != other.charAt(ooffset+<i>k</i>)</tt
>
* <
code>this.charAt(toffset+<i>k</i>) != other.charAt(ooffset+<i>k</i>)</code
>
* </ul>
* </ul>
*
*
* @param toffset the starting offset of the subregion in this string.
* @param toffset the starting offset of the subregion in this string.
...
@@ -1280,28 +1280,28 @@ public final class String
...
@@ -1280,28 +1280,28 @@ public final class String
/**
/**
* Tests if two string regions are equal.
* Tests if two string regions are equal.
* <p>
* <p>
* A substring of this
<tt>String</tt>
object is compared to a substring
* A substring of this
{@code String}
object is compared to a substring
* of the argument
<tt>other</tt>. The result is <tt>true</tt>
if these
* of the argument
{@code other}. The result is {@code true}
if these
* substrings represent character sequences that are the same, ignoring
* substrings represent character sequences that are the same, ignoring
* case if and only if
<tt>ignoreCase</tt>
is true. The substring of
* case if and only if
{@code ignoreCase}
is true. The substring of
* this
<tt>String</tt>
object to be compared begins at index
* this
{@code String}
object to be compared begins at index
*
<tt>toffset</tt> and has length <tt>len</tt>
. The substring of
*
{@code toffset} and has length {@code len}
. The substring of
*
<tt>other</tt> to be compared begins at index <tt>ooffset</tt>
and
*
{@code other} to be compared begins at index {@code ooffset}
and
* has length
<tt>len</tt>. The result is <tt>false</tt>
if and only if
* has length
{@code len}. The result is {@code false}
if and only if
* at least one of the following is true:
* at least one of the following is true:
* <ul><li>
<tt>toffset</tt>
is negative.
* <ul><li>
{@code toffset}
is negative.
* <li>
<tt>ooffset</tt>
is negative.
* <li>
{@code ooffset}
is negative.
* <li>
<tt>toffset+len</tt>
is greater than the length of this
* <li>
{@code toffset+len}
is greater than the length of this
*
<tt>String</tt>
object.
*
{@code String}
object.
* <li>
<tt>ooffset+len</tt>
is greater than the length of the other
* <li>
{@code ooffset+len}
is greater than the length of the other
* argument.
* argument.
* <li>
<tt>ignoreCase</tt> is <tt>false</tt>
and there is some nonnegative
* <li>
{@code ignoreCase} is {@code false}
and there is some nonnegative
* integer <i>k</i> less than
<tt>len</tt>
such that:
* integer <i>k</i> less than
{@code len}
such that:
* <blockquote><pre>
* <blockquote><pre>
* this.charAt(toffset+k) != other.charAt(ooffset+k)
* this.charAt(toffset+k) != other.charAt(ooffset+k)
* </pre></blockquote>
* </pre></blockquote>
* <li>
<tt>ignoreCase</tt> is <tt>true</tt>
and there is some nonnegative
* <li>
{@code ignoreCase} is {@code true}
and there is some nonnegative
* integer <i>k</i> less than
<tt>len</tt>
such that:
* integer <i>k</i> less than
{@code len}
such that:
* <blockquote><pre>
* <blockquote><pre>
* Character.toLowerCase(this.charAt(toffset+k)) !=
* Character.toLowerCase(this.charAt(toffset+k)) !=
Character.toLowerCase(other.charAt(ooffset+k))
Character.toLowerCase(other.charAt(ooffset+k))
...
@@ -1500,12 +1500,12 @@ public final class String
...
@@ -1500,12 +1500,12 @@ public final class String
* of {@code ch} in the range from 0 to 0xFFFF (inclusive),
* of {@code ch} in the range from 0 to 0xFFFF (inclusive),
* this is the smallest value <i>k</i> such that:
* this is the smallest value <i>k</i> such that:
* <blockquote><pre>
* <blockquote><pre>
* (this.charAt(<i>k</i>) == ch)
&&
(<i>k</i> >= fromIndex)
* (this.charAt(<i>k</i>) == ch)
{@code &&}
(<i>k</i> >= fromIndex)
* </pre></blockquote>
* </pre></blockquote>
* is true. For other values of {@code ch}, it is the
* is true. For other values of {@code ch}, it is the
* smallest value <i>k</i> such that:
* smallest value <i>k</i> such that:
* <blockquote><pre>
* <blockquote><pre>
* (this.codePointAt(<i>k</i>) == ch)
&&
(<i>k</i> >= fromIndex)
* (this.codePointAt(<i>k</i>) == ch)
{@code &&}
(<i>k</i> >= fromIndex)
* </pre></blockquote>
* </pre></blockquote>
* is true. In either case, if no such character occurs in this
* is true. In either case, if no such character occurs in this
* string at or after position {@code fromIndex}, then
* string at or after position {@code fromIndex}, then
...
@@ -1604,12 +1604,12 @@ public final class String
...
@@ -1604,12 +1604,12 @@ public final class String
* from 0 to 0xFFFF (inclusive), the index returned is the largest
* from 0 to 0xFFFF (inclusive), the index returned is the largest
* value <i>k</i> such that:
* value <i>k</i> such that:
* <blockquote><pre>
* <blockquote><pre>
* (this.charAt(<i>k</i>) == ch)
&&
(<i>k</i> <= fromIndex)
* (this.charAt(<i>k</i>) == ch)
{@code &&}
(<i>k</i> <= fromIndex)
* </pre></blockquote>
* </pre></blockquote>
* is true. For other values of {@code ch}, it is the
* is true. For other values of {@code ch}, it is the
* largest value <i>k</i> such that:
* largest value <i>k</i> such that:
* <blockquote><pre>
* <blockquote><pre>
* (this.codePointAt(<i>k</i>) == ch)
&&
(<i>k</i> <= fromIndex)
* (this.codePointAt(<i>k</i>) == ch)
{@code &&}
(<i>k</i> <= fromIndex)
* </pre></blockquote>
* </pre></blockquote>
* is true. In either case, if no such character occurs in this
* is true. In either case, if no such character occurs in this
* string at or before position {@code fromIndex}, then
* string at or before position {@code fromIndex}, then
...
@@ -1690,7 +1690,7 @@ public final class String
...
@@ -1690,7 +1690,7 @@ public final class String
*
*
* <p>The returned index is the smallest value <i>k</i> for which:
* <p>The returned index is the smallest value <i>k</i> for which:
* <blockquote><pre>
* <blockquote><pre>
* <i>k</i> >= fromIndex
&&
this.startsWith(str, <i>k</i>)
* <i>k</i> >= fromIndex
{@code &&}
this.startsWith(str, <i>k</i>)
* </pre></blockquote>
* </pre></blockquote>
* If no such value of <i>k</i> exists, then {@code -1} is returned.
* If no such value of <i>k</i> exists, then {@code -1} is returned.
*
*
...
@@ -1799,7 +1799,7 @@ public final class String
...
@@ -1799,7 +1799,7 @@ public final class String
*
*
* <p>The returned index is the largest value <i>k</i> for which:
* <p>The returned index is the largest value <i>k</i> for which:
* <blockquote><pre>
* <blockquote><pre>
* <i>k</i>
<= fromIndex &&
this.startsWith(str, <i>k</i>)
* <i>k</i>
{@code <=} fromIndex {@code &&}
this.startsWith(str, <i>k</i>)
* </pre></blockquote>
* </pre></blockquote>
* If no such value of <i>k</i> exists, then {@code -1} is returned.
* If no such value of <i>k</i> exists, then {@code -1} is returned.
*
*
...
@@ -2080,17 +2080,18 @@ public final class String
...
@@ -2080,17 +2080,18 @@ public final class String
* href="../util/regex/Pattern.html#sum">regular expression</a>.
* href="../util/regex/Pattern.html#sum">regular expression</a>.
*
*
* <p> An invocation of this method of the form
* <p> An invocation of this method of the form
* <i>str</i>
<tt>.matches(</tt><i>regex</i><tt>)</tt>
yields exactly the
* <i>str</i>
{@code .matches(}<i>regex</i>{@code )}
yields exactly the
* same result as the expression
* same result as the expression
*
*
* <blockquote><tt> {@link java.util.regex.Pattern}.{@link
* <blockquote>
* java.util.regex.Pattern#matches(String,CharSequence)
* {@link java.util.regex.Pattern}.{@link java.util.regex.Pattern#matches(String,CharSequence)
* matches}(</tt><i>regex</i><tt>,</tt> <i>str</i><tt>)</tt></blockquote>
* matches(<i>regex</i>, <i>str</i>)}
* </blockquote>
*
*
* @param regex
* @param regex
* the regular expression to which this string is to be matched
* the regular expression to which this string is to be matched
*
*
* @return
<tt>true</tt>
if, and only if, this string matches the
* @return
{@code true}
if, and only if, this string matches the
* given regular expression
* given regular expression
*
*
* @throws PatternSyntaxException
* @throws PatternSyntaxException
...
@@ -2124,18 +2125,20 @@ public final class String
...
@@ -2124,18 +2125,20 @@ public final class String
* given replacement.
* given replacement.
*
*
* <p> An invocation of this method of the form
* <p> An invocation of this method of the form
* <i>str</i>
<tt>.replaceFirst(</tt><i>regex</i><tt>,</tt> <i>repl</i><tt>)</tt>
* <i>str</i>
{@code .replaceFirst(}<i>regex</i>{@code ,} <i>repl</i>{@code )}
* yields exactly the same result as the expression
* yields exactly the same result as the expression
*
*
* <blockquote><tt>
* <blockquote>
* {@link java.util.regex.Pattern}.{@link java.util.regex.Pattern#compile
* <code>
* compile}(</tt><i>regex</i><tt>).{@link
* {@link java.util.regex.Pattern}.{@link
* java.util.regex.Pattern#matcher(java.lang.CharSequence)
* java.util.regex.Pattern#compile compile}(<i>regex</i>).{@link
* matcher}(</tt><i>str</i><tt>).{@link java.util.regex.Matcher#replaceFirst
* java.util.regex.Pattern#matcher(java.lang.CharSequence) matcher}(<i>str</i>).{@link
* replaceFirst}(</tt><i>repl</i><tt>)</tt></blockquote>
* java.util.regex.Matcher#replaceFirst replaceFirst}(<i>repl</i>)
* </code>
* </blockquote>
*
*
*<p>
*<p>
* Note that backslashes (
<tt>\</tt>) and dollar signs (<tt>$</tt>
) in the
* Note that backslashes (
{@code \}) and dollar signs ({@code $}
) in the
* replacement string may cause the results to be different than if it were
* replacement string may cause the results to be different than if it were
* being treated as a literal replacement string; see
* being treated as a literal replacement string; see
* {@link java.util.regex.Matcher#replaceFirst}.
* {@link java.util.regex.Matcher#replaceFirst}.
...
@@ -2147,7 +2150,7 @@ public final class String
...
@@ -2147,7 +2150,7 @@ public final class String
* @param replacement
* @param replacement
* the string to be substituted for the first match
* the string to be substituted for the first match
*
*
* @return The resulting
<tt>String</tt>
* @return The resulting
{@code String}
*
*
* @throws PatternSyntaxException
* @throws PatternSyntaxException
* if the regular expression's syntax is invalid
* if the regular expression's syntax is invalid
...
@@ -2167,18 +2170,20 @@ public final class String
...
@@ -2167,18 +2170,20 @@ public final class String
* given replacement.
* given replacement.
*
*
* <p> An invocation of this method of the form
* <p> An invocation of this method of the form
* <i>str</i>
<tt>.replaceAll(</tt><i>regex</i><tt>,</tt> <i>repl</i><tt>)</tt>
* <i>str</i>
{@code .replaceAll(}<i>regex</i>{@code ,} <i>repl</i>{@code )}
* yields exactly the same result as the expression
* yields exactly the same result as the expression
*
*
* <blockquote><tt>
* <blockquote>
* {@link java.util.regex.Pattern}.{@link java.util.regex.Pattern#compile
* <code>
* compile}(</tt><i>regex</i><tt>).{@link
* {@link java.util.regex.Pattern}.{@link
* java.util.regex.Pattern#matcher(java.lang.CharSequence)
* java.util.regex.Pattern#compile compile}(<i>regex</i>).{@link
* matcher}(</tt><i>str</i><tt>).{@link java.util.regex.Matcher#replaceAll
* java.util.regex.Pattern#matcher(java.lang.CharSequence) matcher}(<i>str</i>).{@link
* replaceAll}(</tt><i>repl</i><tt>)</tt></blockquote>
* java.util.regex.Matcher#replaceAll replaceAll}(<i>repl</i>)
* </code>
* </blockquote>
*
*
*<p>
*<p>
* Note that backslashes (
<tt>\</tt>) and dollar signs (<tt>$</tt>
) in the
* Note that backslashes (
{@code \}) and dollar signs ({@code $}
) in the
* replacement string may cause the results to be different than if it were
* replacement string may cause the results to be different than if it were
* being treated as a literal replacement string; see
* being treated as a literal replacement string; see
* {@link java.util.regex.Matcher#replaceAll Matcher.replaceAll}.
* {@link java.util.regex.Matcher#replaceAll Matcher.replaceAll}.
...
@@ -2190,7 +2195,7 @@ public final class String
...
@@ -2190,7 +2195,7 @@ public final class String
* @param replacement
* @param replacement
* the string to be substituted for each match
* the string to be substituted for each match
*
*
* @return The resulting
<tt>String</tt>
* @return The resulting
{@code String}
*
*
* @throws PatternSyntaxException
* @throws PatternSyntaxException
* if the regular expression's syntax is invalid
* if the regular expression's syntax is invalid
...
@@ -2234,7 +2239,7 @@ public final class String
...
@@ -2234,7 +2239,7 @@ public final class String
* expression does not match any part of the input then the resulting array
* expression does not match any part of the input then the resulting array
* has just one element, namely this string.
* has just one element, namely this string.
*
*
* <p> The
<tt>limit</tt>
parameter controls the number of times the
* <p> The
{@code limit}
parameter controls the number of times the
* pattern is applied and therefore affects the length of the resulting
* pattern is applied and therefore affects the length of the resulting
* array. If the limit <i>n</i> is greater than zero then the pattern
* array. If the limit <i>n</i> is greater than zero then the pattern
* will be applied at most <i>n</i> - 1 times, the array's
* will be applied at most <i>n</i> - 1 times, the array's
...
@@ -2245,7 +2250,7 @@ public final class String
...
@@ -2245,7 +2250,7 @@ public final class String
* the pattern will be applied as many times as possible, the array can
* the pattern will be applied as many times as possible, the array can
* have any length, and trailing empty strings will be discarded.
* have any length, and trailing empty strings will be discarded.
*
*
* <p> The string
<tt>"boo:and:foo"</tt>
, for example, yields the
* <p> The string
{@code "boo:and:foo"}
, for example, yields the
* following results with these parameters:
* following results with these parameters:
*
*
* <blockquote><table cellpadding=1 cellspacing=0 summary="Split example showing regex, limit, and result">
* <blockquote><table cellpadding=1 cellspacing=0 summary="Split example showing regex, limit, and result">
...
@@ -2256,33 +2261,34 @@ public final class String
...
@@ -2256,33 +2261,34 @@ public final class String
* </tr>
* </tr>
* <tr><td align=center>:</td>
* <tr><td align=center>:</td>
* <td align=center>2</td>
* <td align=center>2</td>
* <td>
<tt>{ "boo", "and:foo" }</tt>
</td></tr>
* <td>
{@code { "boo", "and:foo" }}
</td></tr>
* <tr><td align=center>:</td>
* <tr><td align=center>:</td>
* <td align=center>5</td>
* <td align=center>5</td>
* <td>
<tt>{ "boo", "and", "foo" }</tt>
</td></tr>
* <td>
{@code { "boo", "and", "foo" }}
</td></tr>
* <tr><td align=center>:</td>
* <tr><td align=center>:</td>
* <td align=center>-2</td>
* <td align=center>-2</td>
* <td>
<tt>{ "boo", "and", "foo" }</tt>
</td></tr>
* <td>
{@code { "boo", "and", "foo" }}
</td></tr>
* <tr><td align=center>o</td>
* <tr><td align=center>o</td>
* <td align=center>5</td>
* <td align=center>5</td>
* <td>
<tt>{ "b", "", ":and:f", "", "" }</tt>
</td></tr>
* <td>
{@code { "b", "", ":and:f", "", "" }}
</td></tr>
* <tr><td align=center>o</td>
* <tr><td align=center>o</td>
* <td align=center>-2</td>
* <td align=center>-2</td>
* <td>
<tt>{ "b", "", ":and:f", "", "" }</tt>
</td></tr>
* <td>
{@code { "b", "", ":and:f", "", "" }}
</td></tr>
* <tr><td align=center>o</td>
* <tr><td align=center>o</td>
* <td align=center>0</td>
* <td align=center>0</td>
* <td>
<tt>{ "b", "", ":and:f" }</tt>
</td></tr>
* <td>
{@code { "b", "", ":and:f" }}
</td></tr>
* </table></blockquote>
* </table></blockquote>
*
*
* <p> An invocation of this method of the form
* <p> An invocation of this method of the form
* <i>str.</i>
<tt>split(</tt><i>regex</i><tt>,</tt> <i>n</i><tt>)</tt>
* <i>str.</i>
{@code split(}<i>regex</i>{@code ,} <i>n</i>{@code )}
* yields the same result as the expression
* yields the same result as the expression
*
*
* <blockquote>
* <blockquote>
* {@link java.util.regex.Pattern}.{@link java.util.regex.Pattern#compile
* <code>
* compile}<tt>(</tt><i>regex</i><tt>)</tt>.{@link
* {@link java.util.regex.Pattern}.{@link
* java.util.regex.Pattern#split(java.lang.CharSequence,int)
* java.util.regex.Pattern#compile compile}(<i>regex</i>).{@link
* split}<tt>(</tt><i>str</i><tt>,</tt> <i>n</i><tt>)</tt>
* java.util.regex.Pattern#split(java.lang.CharSequence,int) split}(<i>str</i>, <i>n</i>)
* </code>
* </blockquote>
* </blockquote>
*
*
*
*
...
@@ -2364,7 +2370,7 @@ public final class String
...
@@ -2364,7 +2370,7 @@ public final class String
* argument of zero. Trailing empty strings are therefore not included in
* argument of zero. Trailing empty strings are therefore not included in
* the resulting array.
* the resulting array.
*
*
* <p> The string
<tt>"boo:and:foo"</tt>
, for example, yields the following
* <p> The string
{@code "boo:and:foo"}
, for example, yields the following
* results with these expressions:
* results with these expressions:
*
*
* <blockquote><table cellpadding=1 cellspacing=0 summary="Split examples showing regex and result">
* <blockquote><table cellpadding=1 cellspacing=0 summary="Split examples showing regex and result">
...
@@ -2373,9 +2379,9 @@ public final class String
...
@@ -2373,9 +2379,9 @@ public final class String
* <th>Result</th>
* <th>Result</th>
* </tr>
* </tr>
* <tr><td align=center>:</td>
* <tr><td align=center>:</td>
* <td>
<tt>{ "boo", "and", "foo" }</tt>
</td></tr>
* <td>
{@code { "boo", "and", "foo" }}
</td></tr>
* <tr><td align=center>o</td>
* <tr><td align=center>o</td>
* <td>
<tt>{ "b", "", ":and:f" }</tt>
</td></tr>
* <td>
{@code { "b", "", ":and:f" }}
</td></tr>
* </table></blockquote>
* </table></blockquote>
*
*
*
*
...
@@ -2815,7 +2821,7 @@ public final class String
...
@@ -2815,7 +2821,7 @@ public final class String
* limited by the maximum dimension of a Java array as defined by
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
* <cite>The Java™ Virtual Machine Specification</cite>.
* The behaviour on a
* The behaviour on a
*
<tt>null</tt>
argument depends on the <a
*
{@code null}
argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
* href="../util/Formatter.html#syntax">conversion</a>.
*
*
* @throws java.util.IllegalFormatException
* @throws java.util.IllegalFormatException
...
@@ -2828,7 +2834,7 @@ public final class String
...
@@ -2828,7 +2834,7 @@ public final class String
* formatter class specification.
* formatter class specification.
*
*
* @throws NullPointerException
* @throws NullPointerException
* If the
<tt>format</tt> is <tt>null</tt>
* If the
{@code format} is {@code null}
*
*
* @return A formatted string
* @return A formatted string
*
*
...
@@ -2845,7 +2851,7 @@ public final class String
...
@@ -2845,7 +2851,7 @@ public final class String
*
*
* @param l
* @param l
* The {@linkplain java.util.Locale locale} to apply during
* The {@linkplain java.util.Locale locale} to apply during
* formatting. If
<tt>l</tt> is <tt>null</tt>
then no localization
* formatting. If
{@code l} is {@code null}
then no localization
* is applied.
* is applied.
*
*
* @param format
* @param format
...
@@ -2859,7 +2865,7 @@ public final class String
...
@@ -2859,7 +2865,7 @@ public final class String
* limited by the maximum dimension of a Java array as defined by
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
* <cite>The Java™ Virtual Machine Specification</cite>.
* The behaviour on a
* The behaviour on a
*
<tt>null</tt>
argument depends on the <a
*
{@code null}
argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
* href="../util/Formatter.html#syntax">conversion</a>.
*
*
* @throws java.util.IllegalFormatException
* @throws java.util.IllegalFormatException
...
@@ -2872,7 +2878,7 @@ public final class String
...
@@ -2872,7 +2878,7 @@ public final class String
* formatter class specification
* formatter class specification
*
*
* @throws NullPointerException
* @throws NullPointerException
* If the
<tt>format</tt> is <tt>null</tt>
* If the
{@code format} is {@code null}
*
*
* @return A formatted string
* @return A formatted string
*
*
...
@@ -3143,7 +3149,7 @@ public final class String
...
@@ -3143,7 +3149,7 @@ public final class String
* programmer should be aware that producing distinct integer results
* programmer should be aware that producing distinct integer results
* for unequal objects may improve the performance of hash tables.
* for unequal objects may improve the performance of hash tables.
* </ul>
* </ul>
* <
p/
>
* <
/p
>
* The hash value will never be zero.
* The hash value will never be zero.
*
*
* @return a hash code value for this object.
* @return a hash code value for this object.
...
...
src/share/classes/java/lang/StringBuffer.java
浏览文件 @
fd96bc14
...
@@ -57,7 +57,7 @@ package java.lang;
...
@@ -57,7 +57,7 @@ package java.lang;
* <p>
* <p>
* In general, if sb refers to an instance of a {@code StringBuffer},
* In general, if sb refers to an instance of a {@code StringBuffer},
* then {@code sb.append(x)} has the same effect as
* then {@code sb.append(x)} has the same effect as
* {@code sb.insert(sb.length(),
x)}.
* {@code sb.insert(sb.length(),
x)}.
* <p>
* <p>
* Whenever an operation occurs involving a source sequence (such as
* Whenever an operation occurs involving a source sequence (such as
* appending or inserting from a source sequence), this class synchronizes
* appending or inserting from a source sequence), this class synchronizes
...
@@ -80,7 +80,7 @@ package java.lang;
...
@@ -80,7 +80,7 @@ package java.lang;
*
*
* As of release JDK 5, this class has been supplemented with an equivalent
* As of release JDK 5, this class has been supplemented with an equivalent
* class designed for use by a single thread, {@link StringBuilder}. The
* class designed for use by a single thread, {@link StringBuilder}. The
*
<tt>StringBuilder</tt>
class should generally be used in preference to
*
{@code StringBuilder}
class should generally be used in preference to
* this one, as it supports all of the same operations but it is faster, as
* this one, as it supports all of the same operations but it is faster, as
* it performs no synchronization.
* it performs no synchronization.
*
*
...
@@ -262,17 +262,17 @@ package java.lang;
...
@@ -262,17 +262,17 @@ package java.lang;
}
}
/**
/**
* Appends the specified
<tt>StringBuffer</tt>
to this sequence.
* Appends the specified
{@code StringBuffer}
to this sequence.
* <p>
* <p>
* The characters of the
<tt>StringBuffer</tt>
argument are appended,
* The characters of the
{@code StringBuffer}
argument are appended,
* in order, to the contents of this
<tt>StringBuffer</tt>
, increasing the
* in order, to the contents of this
{@code StringBuffer}
, increasing the
* length of this
<tt>StringBuffer</tt>
by the length of the argument.
* length of this
{@code StringBuffer}
by the length of the argument.
* If
<tt>sb</tt> is <tt>null</tt>
, then the four characters
* If
{@code sb} is {@code null}
, then the four characters
*
<tt>"null"</tt> are appended to this <tt>StringBuffer</tt>
.
*
{@code "null"} are appended to this {@code StringBuffer}
.
* <p>
* <p>
* Let <i>n</i> be the length of the old character sequence, the one
* Let <i>n</i> be the length of the old character sequence, the one
* contained in the
<tt>StringBuffer</tt>
just prior to execution of the
* contained in the
{@code StringBuffer}
just prior to execution of the
*
<tt>append</tt>
method. Then the character at index <i>k</i> in
*
{@code append}
method. Then the character at index <i>k</i> in
* the new character sequence is equal to the character at index <i>k</i>
* the new character sequence is equal to the character at index <i>k</i>
* in the old character sequence, if <i>k</i> is less than <i>n</i>;
* in the old character sequence, if <i>k</i> is less than <i>n</i>;
* otherwise, it is equal to the character at index <i>k-n</i> in the
* otherwise, it is equal to the character at index <i>k-n</i> in the
...
@@ -281,7 +281,7 @@ package java.lang;
...
@@ -281,7 +281,7 @@ package java.lang;
* This method synchronizes on {@code this}, the destination
* This method synchronizes on {@code this}, the destination
* object, but does not synchronize on the source ({@code sb}).
* object, but does not synchronize on the source ({@code sb}).
*
*
* @param sb the
<tt>StringBuffer</tt>
to append.
* @param sb the
{@code StringBuffer}
to append.
* @return a reference to this object.
* @return a reference to this object.
* @since 1.4
* @since 1.4
*/
*/
...
...
src/share/classes/java/lang/StringBuilder.java
浏览文件 @
fd96bc14
...
@@ -28,39 +28,39 @@ package java.lang;
...
@@ -28,39 +28,39 @@ package java.lang;
/**
/**
* A mutable sequence of characters. This class provides an API compatible
* A mutable sequence of characters. This class provides an API compatible
* with
<code>StringBuffer</code>
, but with no guarantee of synchronization.
* with
{@code StringBuffer}
, but with no guarantee of synchronization.
* This class is designed for use as a drop-in replacement for
* This class is designed for use as a drop-in replacement for
*
<code>StringBuffer</code>
in places where the string buffer was being
*
{@code StringBuffer}
in places where the string buffer was being
* used by a single thread (as is generally the case). Where possible,
* used by a single thread (as is generally the case). Where possible,
* it is recommended that this class be used in preference to
* it is recommended that this class be used in preference to
*
<code>StringBuffer</code>
as it will be faster under most implementations.
*
{@code StringBuffer}
as it will be faster under most implementations.
*
*
* <p>The principal operations on a
<code>StringBuilder</code>
are the
* <p>The principal operations on a
{@code StringBuilder}
are the
*
<code>append</code> and <code>insert</code>
methods, which are
*
{@code append} and {@code insert}
methods, which are
* overloaded so as to accept data of any type. Each effectively
* overloaded so as to accept data of any type. Each effectively
* converts a given datum to a string and then appends or inserts the
* converts a given datum to a string and then appends or inserts the
* characters of that string to the string builder. The
* characters of that string to the string builder. The
*
<code>append</code>
method always adds these characters at the end
*
{@code append}
method always adds these characters at the end
* of the builder; the
<code>insert</code>
method adds the characters at
* of the builder; the
{@code insert}
method adds the characters at
* a specified point.
* a specified point.
* <p>
* <p>
* For example, if <code>z</code> refers to a string builder object
* For example, if {@code z} refers to a string builder object
* whose current contents are "<code>start</code>", then
* whose current contents are "{@code start}", then
* the method call <code>z.append("le")</code> would cause the string
* the method call {@code z.append("le")} would cause the string
* builder to contain "<code>startle</code>", whereas
* builder to contain "{@code startle}", whereas
* <code>z.insert(4, "le")</code> would alter the string builder to
* {@code z.insert(4, "le")} would alter the string builder to
* contain "<code>starlet</code>".
* contain "{@code starlet}".
* <p>
* In general, if sb refers to an instance of a {@code StringBuilder},
* then {@code sb.append(x)} has the same effect as
* {@code sb.insert(sb.length(), x)}.
* <p>
* <p>
* In general, if sb refers to an instance of a <code>StringBuilder</code>,
* then <code>sb.append(x)</code> has the same effect as
* <code>sb.insert(sb.length(), x)</code>.
*
* Every string builder has a capacity. As long as the length of the
* Every string builder has a capacity. As long as the length of the
* character sequence contained in the string builder does not exceed
* character sequence contained in the string builder does not exceed
* the capacity, it is not necessary to allocate a new internal
* the capacity, it is not necessary to allocate a new internal
* buffer. If the internal buffer overflows, it is automatically made larger.
* buffer. If the internal buffer overflows, it is automatically made larger.
*
*
* <p>Instances of
<code>StringBuilder</code>
are not safe for
* <p>Instances of
{@code StringBuilder}
are not safe for
* use by multiple threads. If such synchronization is required then it is
* use by multiple threads. If such synchronization is required then it is
* recommended that {@link java.lang.StringBuffer} be used.
* recommended that {@link java.lang.StringBuffer} be used.
*
*
...
@@ -87,11 +87,11 @@ public final class StringBuilder
...
@@ -87,11 +87,11 @@ public final class StringBuilder
/**
/**
* Constructs a string builder with no characters in it and an
* Constructs a string builder with no characters in it and an
* initial capacity specified by the
<code>capacity</code>
argument.
* initial capacity specified by the
{@code capacity}
argument.
*
*
* @param capacity the initial capacity.
* @param capacity the initial capacity.
* @throws NegativeArraySizeException if the
<code>capacity</code>
* @throws NegativeArraySizeException if the
{@code capacity}
* argument is less than
<code>0</code>
.
* argument is less than
{@code 0}
.
*/
*/
public
StringBuilder
(
int
capacity
)
{
public
StringBuilder
(
int
capacity
)
{
super
(
capacity
);
super
(
capacity
);
...
@@ -100,10 +100,10 @@ public final class StringBuilder
...
@@ -100,10 +100,10 @@ public final class StringBuilder
/**
/**
* Constructs a string builder initialized to the contents of the
* Constructs a string builder initialized to the contents of the
* specified string. The initial capacity of the string builder is
* specified string. The initial capacity of the string builder is
*
<code>16</code>
plus the length of the string argument.
*
{@code 16}
plus the length of the string argument.
*
*
* @param str the initial contents of the buffer.
* @param str the initial contents of the buffer.
* @throws NullPointerException if
<code>str</code> is <code>null</code>
* @throws NullPointerException if
{@code str} is {@code null}
*/
*/
public
StringBuilder
(
String
str
)
{
public
StringBuilder
(
String
str
)
{
super
(
str
.
length
()
+
16
);
super
(
str
.
length
()
+
16
);
...
@@ -112,12 +112,12 @@ public final class StringBuilder
...
@@ -112,12 +112,12 @@ public final class StringBuilder
/**
/**
* Constructs a string builder that contains the same characters
* Constructs a string builder that contains the same characters
* as the specified
<code>CharSequence</code>
. The initial capacity of
* as the specified
{@code CharSequence}
. The initial capacity of
* the string builder is
<code>16</code>
plus the length of the
* the string builder is
{@code 16}
plus the length of the
*
<code>CharSequence</code>
argument.
*
{@code CharSequence}
argument.
*
*
* @param seq the sequence to copy.
* @param seq the sequence to copy.
* @throws NullPointerException if
<code>seq</code> is <code>null</code>
* @throws NullPointerException if
{@code seq} is {@code null}
*/
*/
public
StringBuilder
(
CharSequence
seq
)
{
public
StringBuilder
(
CharSequence
seq
)
{
this
(
seq
.
length
()
+
16
);
this
(
seq
.
length
()
+
16
);
...
@@ -136,22 +136,22 @@ public final class StringBuilder
...
@@ -136,22 +136,22 @@ public final class StringBuilder
}
}
/**
/**
* Appends the specified
<tt>StringBuffer</tt>
to this sequence.
* Appends the specified
{@code StringBuffer}
to this sequence.
* <p>
* <p>
* The characters of the
<tt>StringBuffer</tt>
argument are appended,
* The characters of the
{@code StringBuffer}
argument are appended,
* in order, to this sequence, increasing the
* in order, to this sequence, increasing the
* length of this sequence by the length of the argument.
* length of this sequence by the length of the argument.
* If
<tt>sb</tt> is <tt>null</tt>
, then the four characters
* If
{@code sb} is {@code null}
, then the four characters
*
<tt>"null"</tt>
are appended to this sequence.
*
{@code "null"}
are appended to this sequence.
* <p>
* <p>
* Let <i>n</i> be the length of this character sequence just prior to
* Let <i>n</i> be the length of this character sequence just prior to
* execution of the
<tt>append</tt>
method. Then the character at index
* execution of the
{@code append}
method. Then the character at index
* <i>k</i> in the new character sequence is equal to the character at
* <i>k</i> in the new character sequence is equal to the character at
* index <i>k</i> in the old character sequence, if <i>k</i> is less than
* index <i>k</i> in the old character sequence, if <i>k</i> is less than
* <i>n</i>; otherwise, it is equal to the character at index <i>k-n</i>
* <i>n</i>; otherwise, it is equal to the character at index <i>k-n</i>
* in the argument
<code>sb</code>
.
* in the argument
{@code sb}
.
*
*
* @param sb the
<tt>StringBuffer</tt>
to append.
* @param sb the
{@code StringBuffer}
to append.
* @return a reference to this object.
* @return a reference to this object.
*/
*/
public
StringBuilder
append
(
StringBuffer
sb
)
{
public
StringBuilder
append
(
StringBuffer
sb
)
{
...
@@ -418,13 +418,13 @@ public final class StringBuilder
...
@@ -418,13 +418,13 @@ public final class StringBuilder
}
}
/**
/**
* Save the state of the
<tt>StringBuilder</tt>
instance to a stream
* Save the state of the
{@code StringBuilder}
instance to a stream
* (that is, serialize it).
* (that is, serialize it).
*
*
* @serialData the number of characters currently stored in the string
* @serialData the number of characters currently stored in the string
* builder (
<tt>int</tt>
), followed by the characters in the
* builder (
{@code int}
), followed by the characters in the
* string builder (
<tt>char[]</tt>
). The length of the
* string builder (
{@code char[]}
). The length of the
*
<tt>char</tt>
array may be greater than the number of
*
{@code char}
array may be greater than the number of
* characters currently stored in the string builder, in which
* characters currently stored in the string builder, in which
* case extra characters are ignored.
* case extra characters are ignored.
*/
*/
...
...
src/share/classes/java/lang/StringIndexOutOfBoundsException.java
浏览文件 @
fd96bc14
/*
/*
* Copyright (c) 1994, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 20
12
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
package
java.lang
;
package
java.lang
;
/**
/**
* Thrown by
<code>String</code>
methods to indicate that an index
* Thrown by
{@code String}
methods to indicate that an index
* is either negative or greater than the size of the string. For
* is either negative or greater than the size of the string. For
* some methods such as the charAt method, this exception also is
* some methods such as the charAt method, this exception also is
* thrown when the index is equal to the size of the string.
* thrown when the index is equal to the size of the string.
...
@@ -40,7 +40,7 @@ class StringIndexOutOfBoundsException extends IndexOutOfBoundsException {
...
@@ -40,7 +40,7 @@ class StringIndexOutOfBoundsException extends IndexOutOfBoundsException {
private
static
final
long
serialVersionUID
=
-
6762910422159637258L
;
private
static
final
long
serialVersionUID
=
-
6762910422159637258L
;
/**
/**
* Constructs a
<code>StringIndexOutOfBoundsException</code>
with no
* Constructs a
{@code StringIndexOutOfBoundsException}
with no
* detail message.
* detail message.
*
*
* @since JDK1.0.
* @since JDK1.0.
...
@@ -50,7 +50,7 @@ class StringIndexOutOfBoundsException extends IndexOutOfBoundsException {
...
@@ -50,7 +50,7 @@ class StringIndexOutOfBoundsException extends IndexOutOfBoundsException {
}
}
/**
/**
* Constructs a
<code>StringIndexOutOfBoundsException</code>
with
* Constructs a
{@code StringIndexOutOfBoundsException}
with
* the specified detail message.
* the specified detail message.
*
*
* @param s the detail message.
* @param s the detail message.
...
@@ -60,7 +60,7 @@ class StringIndexOutOfBoundsException extends IndexOutOfBoundsException {
...
@@ -60,7 +60,7 @@ class StringIndexOutOfBoundsException extends IndexOutOfBoundsException {
}
}
/**
/**
* Constructs a new
<code>StringIndexOutOfBoundsException</code>
* Constructs a new
{@code StringIndexOutOfBoundsException}
* class with an argument indicating the illegal index.
* class with an argument indicating the illegal index.
*
*
* @param index the illegal index.
* @param index the illegal index.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录