segmentLength

trait Collection[A] {
  def segmentLength(p: (A) => Boolean, j: Int): Int
}

segmentLength returns the length of the largest segment of elements starting at j that satisfy the predicate p.