报告 Set
上的 filter
或 filterNot
并建议改用 intersect
或 diff
。
示例:
val set = Set(1, 2)
val others = Set(2, 3)
set.filter(others.contains(_))
set.filterNot(others.contains)
set.filter(x => !others.contains(x))
set.filterNot(x => !others.contains(x))
在应用快速修复后:
val set = Set(1, 2)
val others = Set(2, 3)
set.intersect(others)
set.diff(others)
set.diff(others)
set.intersect(others)