I have searched for ArrayList capacity questions but could not find a complete answer. so asking it again here.
I understand that size the number of elements we add in ArrayList and capacity is how much data we can put in that list with the default value to be 10.
So the question here is while declaring if give the capacity to be like this
List<String> list = new ArrayList<>(1);
Then also I can keep on adding the elements up to 10 or 20. So is this capacity declaration useful only to internal reallocation which happens when it reaches the capacity?
Or by giving the capacity limit can we restrict only to that point of add elements?