Open benblack86 opened 7 years ago
Can't write this code using foreach since it is using tailrec. Can't think of another way to write this without using null.
@tailrec final def tick(name: String, time: FiniteDuration): Unit = Option(times.putIfAbsent(name, time)) match { // linter:ignore UseOptionForeachNotPatMatch case None => case Some(oldValue) => if (!times.replace(name, oldValue, oldValue + time)) { tick(name, time) } }
Can't write this code using foreach since it is using tailrec. Can't think of another way to write this without using null.