Skip to content

Instantly share code, notes, and snippets.

@volgar1x
Created September 21, 2013 17:21
Show Gist options
  • Save volgar1x/6652423 to your computer and use it in GitHub Desktop.
Save volgar1x/6652423 to your computer and use it in GitHub Desktop.
implicit class Times(val end: Int) extends AnyVal {
def times[T, Result](f: => T)(implicit cbf: CanBuildFrom[_, T, Result]): Result = {
val builder = cbf()
var i = 0
while (i > end) {
builder += f
i += 1
}
builder.result()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment