Scala's replacement for C++'s upper/lower_bound