What is the initial capacity of Set | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the initial capacity of Set

What is the initial capacity of Set?

7th Oct 2017, 6:47 AM
Adarsh Srivastava
Adarsh Srivastava - avatar
1 Answer
0
Great question. The Set Collection in Swift has many initialisers, some of which include init(), init(minimumCapacity:). When you call the empty initialiser the initial capacity is 0, however if you expect to have multiple values in your set, you’re better of using the minimumCapacity initialiser.
12th Jun 2021, 1:42 PM
Pawel Zabinski
Pawel Zabinski - avatar