QuackatronHQ / Gigarepo

Potential NoSuchElementException in accessing filtered elements SC-R1006
Bug risk
Critical
1 occurrence in this check
Consider rewriting arr.filter().head as arr.filter().headOption
21    }
22  }
23
24  def pickFirst1(arr: Array[Int], criteria: Int => Boolean): Int           = arr.filter(criteria).head25  def pickFirst2(arr: Array[Int], criteria: Int => Boolean): Option[Int]   =
26    arr.filter(criteria).headOption
27  def pickInAnOrder(arr: Array[Int], criteria: Int => Boolean): Array[Int] =