NShiftKey-Rule-Guide
1. Vulnerability Description
- When trying to get the result of one of the filters, filter().headOption checks while visiting all collections, which may reduce performance.
2. Vulnerability Countermeasure
- Use find() instead of filter().headOption
- find() returns only the first one found.
3. Sample Code
seq.filter(p).headOption
seq.find(p)