score:5

Accepted answer

i am not sure about the best practice, but one way you could accomplish this is to us a use a for comprehension 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)

that should yield a list[signalandstate] with all the elements

alternately, you could use a flatmap and map to accomplish the same result, like:

signals flatmap ( signal => states map ( state => new signalandstate(signal, state)))

Related Query

More Query from same tag