I need to add an item to a Seq
depending on a condition.
The only thing I have been able to do is:
if(condition){
part1 ++ part2 ++ Seq(newItem)
}
else {
part1 ++ part2
}
part1
and part2
are Seq[String]
.
It works but there is a lot of repeated code. Any way to do this better?
Thank you