I have the following collection:
private val commandChain: mutable.Buffer[mutable.Buffer[Long]] = ArrayBuffer()
I need to do the following:
def :->(command: Long) = {
commandChain.headOption match {
case Some(node) => node += command
case None => commandChain += ArrayBuffer(command)
}
}
Is there more concise form of this than pattern matching?