Javaソース-AbstractStringBuilder
846 ワード
/**
* The value is used for character storage.
*/
char[] value;
/**
* The count is the number of characters used.
*/
int count;
これはこのような2つのメンバー変数で、valueは文字を格納するために使用されます.value.lengthは文字容量を表します.
countは使用済みの長さを表します.
対応方法:
/**
* Returns the length (character count).
*
* @return the length of the sequence of characters currently
* represented by this object
*/
public int length() {
return count;
}
/**
* Returns the current capacity. The capacity is the amount of storage
* available for newly inserted characters, beyond which an allocation
* will occur.
*
* @return the current capacity
*/
public int capacity() {
return value.length;
}