src/java.base/share/classes/java/lang/StringBuilder.java
changeset 53653 868611f0adc3
parent 49115 ecfaa82c53be
child 54481 f847a42ddc01
equal deleted inserted replaced
53652:262afafdb266 53653:868611f0adc3
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   119      *
   119      *
   120      * @param   str   the initial contents of the buffer.
   120      * @param   str   the initial contents of the buffer.
   121      */
   121      */
   122     @HotSpotIntrinsicCandidate
   122     @HotSpotIntrinsicCandidate
   123     public StringBuilder(String str) {
   123     public StringBuilder(String str) {
   124         super(str.length() + 16);
   124         super(str.coder(), str.length(), 16);
   125         append(str);
   125         append(str);
   126     }
   126     }
   127 
   127 
   128     /**
   128     /**
   129      * Constructs a string builder that contains the same characters
   129      * Constructs a string builder that contains the same characters
   132      * {@code CharSequence} argument.
   132      * {@code CharSequence} argument.
   133      *
   133      *
   134      * @param      seq   the sequence to copy.
   134      * @param      seq   the sequence to copy.
   135      */
   135      */
   136     public StringBuilder(CharSequence seq) {
   136     public StringBuilder(CharSequence seq) {
   137         this(seq.length() + 16);
   137         super(String.LATIN1, seq.length(), 16);
   138         append(seq);
   138         append(seq);
   139     }
   139     }
   140 
   140 
   141     /**
   141     /**
   142      * Compares two {@code StringBuilder} instances lexicographically. This method
   142      * Compares two {@code StringBuilder} instances lexicographically. This method