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
  • 16,853
  • 18
  • 74
  • 88
placeybordeaux
  • 1,928
  • 1
  • 16
  • 35

2 Answers2

19

As described in the deprecated note:

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

try this:

List.fill(100)(1)
Tomasz Nurkiewicz
  • 311,858
  • 65
  • 665
  • 652
8

As the documentation says:

  List.fill(100)(1)
Giovanni Caporaletti
  • 4,996
  • 2
  • 24
  • 37