I have a Module monit
which has an parameter threshold
, then I want to generate serval(e.g.8) Module monit in the wrapper with different threshold . But when I use
val monits = Seq.fill(8)(Module(new monit(32)))
to create 8 modules monit, they all have same threshold, how can I deliver different threshold parameter?
Maybe something like this?
val thresholds = Seq(1,2,3,4,5,6,7,8)
val monits = thresholds.map(th => Module(new monit(th)) )
I typed this on my phone and have not tested the code, but should give an idea about using scala collections and map
for the purpose.