Sets

Overview

Set( [Dictinary] )

It optimized for fast looking up items.

Works like Dictionaries except;

  • Does not remember the order you add values, automatically sorts the data you inserted.

  • Does not allow duplicates, removes them.

  • InDctionary you .append (end to the array) but here you .insert (into the set).

var actors = Set<String>()
actors.insert("Denzel Washington")
actors.insert("Tom Cruise")
actors.insert("Nicolas Cage")
actors.insert("Samuel L Jackson")

print(actors)

Sources

Videos

Articles / Documents

Last updated