140 }
141
142 /**
143 * Constructs a string buffer initialized to the contents of the
144 * specified string. The initial capacity of the string buffer is
145 * {@code 16} plus the length of the string argument.
146 *
147 * @param str the initial contents of the buffer.
148 */
149 @HotSpotIntrinsicCandidate
150 public StringBuffer(String str) {
151 super(str.coder(), str.length(), 16);
152 append(str);
153 }
154
155 /**
156 * Constructs a string buffer that contains the same characters
157 * as the specified {@code CharSequence}. The initial capacity of
158 * the string buffer is {@code 16} plus the length of the
159 * {@code CharSequence} argument.
160 * <p>
161 * If the length of the specified {@code CharSequence} is
162 * less than or equal to zero, then an empty buffer of capacity
163 * {@code 16} is returned.
164 *
165 * @param seq the sequence to copy.
166 * @since 1.5
167 */
168 public StringBuffer(CharSequence seq) {
169 super(String.LATIN1, seq.length(), 16);
170 append(seq);
171 }
172
173 /**
174 * Compares two {@code StringBuffer} instances lexicographically. This method
175 * follows the same rules for lexicographical comparison as defined in the
176 * {@linkplain java.lang.CharSequence#compare(java.lang.CharSequence,
177 * java.lang.CharSequence) CharSequence.compare(this, another)} method.
178 *
179 * <p>
180 * For finer-grained, locale-sensitive String comparison, refer to
181 * {@link java.text.Collator}.
182 *
183 * @implNote
|
140 }
141
142 /**
143 * Constructs a string buffer initialized to the contents of the
144 * specified string. The initial capacity of the string buffer is
145 * {@code 16} plus the length of the string argument.
146 *
147 * @param str the initial contents of the buffer.
148 */
149 @HotSpotIntrinsicCandidate
150 public StringBuffer(String str) {
151 super(str.coder(), str.length(), 16);
152 append(str);
153 }
154
155 /**
156 * Constructs a string buffer that contains the same characters
157 * as the specified {@code CharSequence}. The initial capacity of
158 * the string buffer is {@code 16} plus the length of the
159 * {@code CharSequence} argument.
160 *
161 * @param seq the sequence to copy.
162 * @since 1.5
163 */
164 public StringBuffer(CharSequence seq) {
165 super(String.LATIN1, seq.length(), 16);
166 append(seq);
167 }
168
169 /**
170 * Compares two {@code StringBuffer} instances lexicographically. This method
171 * follows the same rules for lexicographical comparison as defined in the
172 * {@linkplain java.lang.CharSequence#compare(java.lang.CharSequence,
173 * java.lang.CharSequence) CharSequence.compare(this, another)} method.
174 *
175 * <p>
176 * For finer-grained, locale-sensitive String comparison, refer to
177 * {@link java.text.Collator}.
178 *
179 * @implNote
|