Jamie Taylor
11/21/2019, 4:18 PMdiesieben07
11/21/2019, 4:18 PMmap
always returns a List
, regardless of input. map
on a Set
also returns a List.
Stephan Schroeder
11/21/2019, 4:40 PMSet
it’s probably forced because multiple values could be mapped to the same one and they didn’t want to have the number of elements change within a map
operation.
On Array, it’s probably to avoid to have to reimplement all the operations present on Iterable???Mtsahakis
11/21/2019, 5:05 PMIterable
one but that ship might have sailed as other parts of the api could expect map to return a List
map
operation I had to convert back to an array for my use case.Stephan Schroeder
11/21/2019, 5:11 PMX
= Boolean, Char and all the number types), so you can easily repackage the result of your map-operation in a new array (I guess normal objects shouldn’t be packed into arrays anyway!?)