I would write an iterator.
scala> def itr[A](as: Array[Array[A]]) = new Iterator[(Int, Int, A)] { | private var r = 0 | private var c = -1 | def next = { | if(c == as(r).length - 1) { | c = 0 | r += 1 | } else { | c += 1 | } | (r, c, as(r)(c)) | } | def hasNext = { | !((r == as.length - 1) && (c == as(r).length - 1)) | } | } itr: [A](as: Array[Array[A]])java.lang.Object with Iterator[(Int, Int, A)] scala> val xs = Array.tabulate(5, 6)(_ + _) xs: Array[Array[Int]] = Array(Array(0, 1, 2, 3, 4, 5), Array(1, 2, 3, 4, 5, 6), Array(2, 3, 4, 5, 6, 7), Array(3, 4, 5, 6, 7, 8), Array(4, 5, 6, 7, 8, 9)) scala> itr(xs).find { case (_, _, x) => 5 < x && x <= 7 } res19: Option[(Int, Int, Int)] = Some((1,5,6))