javadocs ArrayList wrote:ArrayList(int initialCapacity)
Constructs an empty list with the specified initial capacity.
Kendall Ponder wrote:So as a programmer I never have to worry about the capacity? Similar to not having to worry about garbage collection?
Kendall Ponder wrote:Do I just need to be aware of it for the Java certification test? Thanks again!
Dasa Beg wrote:StringBuilder sb = new StringBuilder("Test");
When we mention the StringBulider "initial capacity", does that mean the capacity of the object is 16 (without considering the literal "Test" ---> also 16 + 4 = 20)?
Or do we, for this example, have to consider the argument during the instantation (new StringBuilder("Test")), so that the initial capacity for this object would be 20?
Dasa Beg wrote:StringBuilder sb1 = new StringBuilder("CodeRanch");
Is the "initial capacity" for this object 16 or 16 + 9 = 25?
Dasa Beg wrote:StringBulider sb2 = new StringBuilder(128);
What is the "initial capacity" of this StringBuilder object?