Array initializing in Scala - Stack Overflow
stackoverflow.com › questions › 3881013Aug 29, 2017 · To initialize an array filled with zeros, you can use: > Array.fill [Byte] (5) (0) Array (0, 0, 0, 0, 0) This is equivalent to Java's new byte [5]. Share Follow edited Jul 7, 2013 at 18:50 answered Mar 15, 2012 at 11:10 Martin Konicek 37.9k 20 88 96 3 Just FYI, List as an equivalent initializer List.fill (5) (0), accepts even functions.