Hey,
The method List.fill() creates a list and fills it with zero or more copies of an element.
scala> val f=List.fill(7)(1)
f: List[Int] = List(1, 1, 1, 1, 1, 1, 1)
This fills the list with seven instances of the integer 1.
Hope this helps!
If you need to know more about Scala, join Spark course today and become the expert.
Thanks!!