Instance Method インスタンスメソッド

isSubset(of:)

Returns a Boolean value that indicates whether the set is a subset of another set. この集合は別の集合の下位集合であるかどうかを指し示すブール値を返します。

Declaration 宣言

func isSubset(of other: Self) -> Bool

Return Value 戻り値

true if the set is a subset of other; otherwise, false. この集合がotherの部分集合ならばtrue;そうでなければ、false

Parameters パラメータ

other

A set of the same type as the current set. 現在の集合と同じ型の集合。

Discussion 議論

Set A is a subset of another set B if every member of A is also a member of B. 集合Aがもう1つの集合Bの狭義の部分集合であるのは、AのすべてのメンバがまたBのメンバである場合です。


let employees: Set = ["Alicia", "Bethany", "Chris", "Diana", "Eric"]
let attendees: Set = ["Alicia", "Bethany", "Diana"]
print(attendees.isSubset(of: employees))
// Prints "true"