Difference between map and collect in Ruby?

后端 未结 6 1417
遥遥无期
遥遥无期 2020-11-28 00:26

I have Googled this and got patchy / contradictory opinions - is there actually any difference between doing a map and doing a collect on an array

6条回答
  •  死守一世寂寞
    2020-11-28 01:33

    #collect is actually an alias for #map. That means the two methods can be used interchangeably, and effect the same behavior.

提交回复
热议问题