A Counter class for Scala