10

In earlier versions of Scala you can use List.make(100, 1), but that is now deprecated. What is the new proper way to do it?

Nathaniel Ford
  • 20,545
  • 20
  • 91
  • 102
placeybordeaux
  • 2,138
  • 1
  • 20
  • 42

2 Answers2

19

As described in the deprecated note:

@deprecated("use `fill' instead", "2.8.0")

try this:

List.fill(100)(1)
Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674
8

As the documentation says:

  List.fill(100)(1)
Giovanni Caporaletti
  • 5,426
  • 2
  • 26
  • 39