104 * initial capacity specified by the {@code capacity} argument.
105 *
106 * @param capacity the initial capacity.
107 * @throws NegativeArraySizeException if the {@code capacity}
108 * argument is less than {@code 0}.
109 */
110 @HotSpotIntrinsicCandidate
111 public StringBuilder(int capacity) {
112 super(capacity);
113 }
114
115 /**
116 * Constructs a string builder initialized to the contents of the
117 * specified string. The initial capacity of the string builder is
118 * {@code 16} plus the length of the string argument.
119 *
120 * @param str the initial contents of the buffer.
121 */
122 @HotSpotIntrinsicCandidate
123 public StringBuilder(String str) {
124 super(str.coder(), str.length(), 16);
125 append(str);
126 }
127
128 /**
129 * Constructs a string builder that contains the same characters
130 * as the specified {@code CharSequence}. The initial capacity of
131 * the string builder is {@code 16} plus the length of the
132 * {@code CharSequence} argument.
133 *
134 * @param seq the sequence to copy.
135 */
136 public StringBuilder(CharSequence seq) {
137 super(String.LATIN1, seq.length(), 16);
138 append(seq);
139 }
140
141 /**
142 * Compares two {@code StringBuilder} instances lexicographically. This method
143 * follows the same rules for lexicographical comparison as defined in the
144 * {@linkplain java.lang.CharSequence#compare(java.lang.CharSequence,
145 * java.lang.CharSequence) CharSequence.compare(this, another)} method.
146 *
147 * <p>
148 * For finer-grained, locale-sensitive String comparison, refer to
149 * {@link java.text.Collator}.
150 *
151 * @param another the {@code StringBuilder} to be compared with
152 *
153 * @return the value {@code 0} if this {@code StringBuilder} contains the same
154 * character sequence as that of the argument {@code StringBuilder}; a negative integer
155 * if this {@code StringBuilder} is lexicographically less than the
156 * {@code StringBuilder} argument; or a positive integer if this {@code StringBuilder}
157 * is lexicographically greater than the {@code StringBuilder} argument.
158 *
|
104 * initial capacity specified by the {@code capacity} argument.
105 *
106 * @param capacity the initial capacity.
107 * @throws NegativeArraySizeException if the {@code capacity}
108 * argument is less than {@code 0}.
109 */
110 @HotSpotIntrinsicCandidate
111 public StringBuilder(int capacity) {
112 super(capacity);
113 }
114
115 /**
116 * Constructs a string builder initialized to the contents of the
117 * specified string. The initial capacity of the string builder is
118 * {@code 16} plus the length of the string argument.
119 *
120 * @param str the initial contents of the buffer.
121 */
122 @HotSpotIntrinsicCandidate
123 public StringBuilder(String str) {
124 super(str);
125 }
126
127 /**
128 * Constructs a string builder that contains the same characters
129 * as the specified {@code CharSequence}. The initial capacity of
130 * the string builder is {@code 16} plus the length of the
131 * {@code CharSequence} argument.
132 *
133 * @param seq the sequence to copy.
134 */
135 public StringBuilder(CharSequence seq) {
136 super(seq);
137 }
138
139 /**
140 * Compares two {@code StringBuilder} instances lexicographically. This method
141 * follows the same rules for lexicographical comparison as defined in the
142 * {@linkplain java.lang.CharSequence#compare(java.lang.CharSequence,
143 * java.lang.CharSequence) CharSequence.compare(this, another)} method.
144 *
145 * <p>
146 * For finer-grained, locale-sensitive String comparison, refer to
147 * {@link java.text.Collator}.
148 *
149 * @param another the {@code StringBuilder} to be compared with
150 *
151 * @return the value {@code 0} if this {@code StringBuilder} contains the same
152 * character sequence as that of the argument {@code StringBuilder}; a negative integer
153 * if this {@code StringBuilder} is lexicographically less than the
154 * {@code StringBuilder} argument; or a positive integer if this {@code StringBuilder}
155 * is lexicographically greater than the {@code StringBuilder} argument.
156 *
|