Add a flatMap implementation in ported mock-up LinkedList.scala