MutableSet
public class MutableSet<Element> : Sequence, CustomStringConvertible where Element : CustomStringConvertible, Element : Hashable
A mutable, unordered collection of distinct objects.
-
A string representing the set
Declaration
Swift
public var description: String { get }
-
Number of items in set
Declaration
Swift
public var count: Int { get }
-
Sequence method to create an iterator for the MutableSet.
Declaration
Swift
public func makeIterator() -> Set<Element>.Iterator
-
Inserts the given element in the set if it is not already present.
Modifies: self
Effects: adds elem to the set if it is not present
Declaration
Swift
public func insert(_ elem: Element)
Parameters
elem
Element to insert
-
Returns a Boolean value that indicates whether the given element exists in the set.
Declaration
Swift
public func contains(_ elem: Element) -> Bool
Parameters
elem
An element to look for in the set.
Return Value
true if member exists in the set; otherwise, false.