报告 collection.collect(f).headOption 并建议在可能的情况下将其替换为 collection.collectFirst(f)。
collection.collect(f).headOption
collection.collectFirst(f)
示例:
val x: Set[Int] x.collect(f).headOption
在应用快速修复后:
val x: Set[Int] x.collectFirst(f)