Skip to content

Instantly share code, notes, and snippets.

@slimane
Created February 7, 2014 02:18
Show Gist options
  • Save slimane/8856396 to your computer and use it in GitHub Desktop.
Save slimane/8856396 to your computer and use it in GitHub Desktop.
def allSeq(c: Collection, p: T => Boolean, removeItemCnt: Int = 0): List[Int] = {
c.lastIndexWhere(_.p) match{
case n if n == -1 => Nill
case n => (n + removeItemCnt + 1)
:: allIndex(c.remove(n), removeItemCnt + 1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment