What is the best practice to initialize an ArrayList
in Java?
If I initialize a ArrayList using new
operator then, the ArrayList will by default have memory allocated for the 10 buckets (say the object) by default. Which is a performance hit.
I don't know, might be I am wrong, but it seems to me that I must create a ArrayList by mentioning the size, if I am sure about the size.!!!