Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
case class Stats(rollsCounts: Map[Int, Int]) {
def incRollsCount(rolledNumber: Int) = {
val currentCount = rollsCounts.getOrElse(rolledNumber, 0)
copy(rollsCounts = rollsCounts + (rolledNumber -> (currentCount + 1)))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment