I'm not sure about the best practice, but one way to achieve this is to use a for understanding to create the collection you are looking for:
val signals = List[String](...) val states = List[SignalState](...) for(signal <- signals; state <- states) yield new SignalAndState(signal, state)
This should give a List[SignalAndState] with all elements
Alternatively, you can use flatMap and map to achieve the same result, for example:
signals flatMap ( signal => states map ( state => new SignalAndState(signal, state)))
jcern source share