A modifiable CharSequence sequence of characters for use in creating and modifying Strings. This class is intended as a direct replacement of StringBuffer for non-concurrent use; unlike StringBuffer this class is not synchronized for thread safety. The majority of the mod
| 39 | * @since 1.5 |
| 40 | */ |
| 41 | public final class StringBuilder extends AbstractStringBuilder implements |
| 42 | Appendable, CharSequence, Serializable { |
| 43 | |
| 44 | private static final long serialVersionUID = 4383685877147921099L; |
| 45 | |
| 46 | /** |
| 47 | * Constructs an instance with an initial capacity of {@code 16}. |
| 48 | * |
| 49 | * @see #capacity() |
| 50 | */ |
| 51 | public StringBuilder() { |
| 52 | super(); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Constructs an instance with the specified capacity. |
| 57 | * |
| 58 | * @param capacity |
| 59 | * the initial capacity to use. |
| 60 | * @throws NegativeArraySizeException |
| 61 | * if the specified {@code capacity} is negative. |
| 62 | * @see #capacity() |
| 63 | */ |
| 64 | public StringBuilder(int capacity) { |
| 65 | super(capacity); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Constructs an instance that's initialized with the contents of the |
| 70 | * specified {@code CharSequence}. The capacity of the new builder will be |
| 71 | * the length of the {@code CharSequence} plus 16. |
| 72 | * |
| 73 | * @param seq |
| 74 | * the {@code CharSequence} to copy into the builder. |
| 75 | * @throws NullPointerException |
| 76 | * if {@code seq} is {@code null}. |
| 77 | */ |
| 78 | public StringBuilder(CharSequence seq) { |
| 79 | super(seq.toString()); |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Constructs an instance that's initialized with the contents of the |
| 84 | * specified {@code String}. The capacity of the new builder will be the |
| 85 | * length of the {@code String} plus 16. |
| 86 | * |
| 87 | * @param str |
| 88 | * the {@code String} to copy into the builder. |
| 89 | * @throws NullPointerException |
| 90 | * if {@code str} is {@code null}. |
| 91 | */ |
| 92 | public StringBuilder(String str) { |
| 93 | super(str); |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Appends the string representation of the specified {@code boolean} value. |
| 98 | * The {@code boolean} value is converted to a String according to the rule |
nothing calls this directly
no outgoing calls
no test coverage detected