What is the initial capacity of Set | Sololearn: Learn to code for FREE!

0

What is the initial capacity of Set

What is the initial capacity of Set?

10/7/2017 6:47:10 AM

Adarsh Srivastava

1 Answer

New 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.