How to get the initial value when creating a collection

List list = new ArrayList (5);

I’m developing a set initialization related rule, I can’t get ‘5’ when creating a set.
Besides ArrayList, can other sets such as LinkedList, TreeSet, and HashSet also get the initial value in the same way?
If there is any way to tell me this place, I will be grateful.


What language are you writing the rule for? I guess Java?


Hi, Ann,

You’re right. It’s Java. I’m sorry I didn’t describe my situation clearly before.