how to elegantly concatenate an Option[List] to a List?
scala
Solution
To concatenate an Option with a List you can just do `option.toList ++ list`
To concatenate an `Option[List[A]]` with a `List[A]` `optionOfList.toList.flatten ++ list`
The basic idea being you can always convert an option to a list of 0 or one element which makes it easy to combine them with lists in different ways.
Problem
I tried to write those 3 codes without success : ``` aList.foldLeft(List()){(accu, element) => map.get(elment):::accu} aList.foldLeft(List()){(accu, element) => if (!map.get(element).isEmpty) map.get(element):::accu} aList.foldLeft(List()){(accu, element) => map.get(elment).exists(_:::accu)} ``` Does anyone know how to do to concatenate an Option to a list?