本文簡要介紹ruby語言中 Set.disjoint?
的用法。
用法
disjoint?(set)
如果 set 和給定的 enumerable 沒有共同的元素,則返回 true。此方法與 intersect?
相反。
Set[1, 2, 3].disjoint? Set[3, 4] #=> false
Set[1, 2, 3].disjoint? Set[4, 5] #=> true
Set[1, 2, 3].disjoint? [3, 4] #=> false
Set[1, 2, 3].disjoint? 4..5 #=> true
相關用法
- Ruby Set.divide用法及代碼示例
- Ruby Set.replace用法及代碼示例
- Ruby Set.==用法及代碼示例
- Ruby Set.classify用法及代碼示例
- Ruby Set.[]用法及代碼示例
- Ruby Set.===用法及代碼示例
- Ruby Set.-用法及代碼示例
- Ruby Set.to_a用法及代碼示例
- Ruby Set.add?用法及代碼示例
- Ruby Set.add用法及代碼示例
- Ruby Set.|用法及代碼示例
- Ruby Set.^用法及代碼示例
- Ruby Set.&用法及代碼示例
- Ruby Set.new用法及代碼示例
- Ruby Set.intersect?用法及代碼示例
- Ruby Set.clear用法及代碼示例
- Ruby Set flatten()用法及代碼示例
- Ruby Set intersection()用法及代碼示例
- Ruby Set類用法及代碼示例
- Ruby Set size()用法及代碼示例
- Ruby Set compare_by_identity?用法及代碼示例
- Ruby Set merge()用法及代碼示例
- Ruby Set add?用法及代碼示例
- Ruby Set compare_by_identity()用法及代碼示例
- Ruby Set flatten!()用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 Set.disjoint?。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。