Set
A set of unique elements as determined by hashValue
and ==
.
-
This is an implementation detail. Don’t rely on it.
Declaration
Swift
public typealias Unit = Void
-
Constructs the empty
Set
.Declaration
Swift
public init()
-
Constructs a
Set
with the elements ofsequence
.Declaration
Swift
public init <S: SequenceType where S.Generator.Element == T> (_ sequence: S)
-
Constructs a
See moreSet
from a variadic parameter list.Declaration
Swift
public init(_ elements: T...)
-
Constructs a
See moreSet
with a hint as to the capacity it should allocate.Declaration
Swift
public init(minimumCapacity: Int)
-
The number of entries in the set.
Declaration
Swift
public var count: Int
-
True iff
count == 0
Declaration
Swift
public var isEmpty: Bool
-
True iff
element
is in the receiver, as defined by its hash and equality.Declaration
Swift
public func contains(element: T) -> Bool
-
Inserts
element
into the receiver, if it doesn’t already exist.Declaration
Swift
public mutating func insert(element: T)
-
Removes
element
from the receiver, if it’s a member.Declaration
Swift
public mutating func remove(element: T)
-
Removes all elements from the receiver.
Declaration
Swift
public mutating func removeAll()
-
Returns the union of the receiver and
set
.Declaration
Swift
public func union(set: Set<T>) -> Set<T>
-
Returns the intersection of the receiver and
set
.Declaration
Swift
public func intersection(set: Set) -> Set
-
Returns a new set with all elements from the receiver which are not contained in
set
.Declaration
Swift
public func difference(set: Set) -> Set
-
True iff the receiver is a subset of (is included in)
set
.Declaration
Swift
public func subset(set: Set) -> Bool
-
True iff the receiver is a subset of but not equal to
set
.Declaration
Swift
public func strictSubset(set: Set) -> Bool
-
True iff the receiver is a superset of (includes)
set
.Declaration
Swift
public func superset(set: Set) -> Bool
-
True iff the receiver is a superset of but not equal to
set
.Declaration
Swift
public func strictSuperset(set: Set) -> Bool
-
Returns a new set including only those elements
x
whereincludeElement(x)
is true.Declaration
Swift
public func filter(includeElement: (T) -> Bool) -> Set<T>
-
Returns a new set with the result of applying
transform
to each element.Declaration
Swift
public func map <U> (transform: T -> U) -> Set<U>
-
Applies
transform
to each element and returns a new set which is the union of each resulting set.Declaration
Swift
public func flatMap <C: SequenceType>(transform: T -> C) -> Set<C.Generator.Element>
-
Combines each element of the receiver with an accumulator value using
combine
, starting withinitial
.Declaration
Swift
public func reduce <U> (initial: U, combine: (U, T) -> U) -> U