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?
To concatenate an Option with a List you can just do
option.toList ++ listTo concatenate an
Option[List[A]]with aList[A]optionOfList.toList.flatten ++ listThe 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.