4 ms·
I find it easier to read with the exception of the anonymous variables. In scala, I would write val persons = names .map { name => Person(name = n
by ebola1717 10y ago
I find it easier to read with the exception of the anonymous variables. In scala, I would write
val persons = names
.map { name => Person(name = name) }
.filter { person => person.isValid }
- virtualwhys 10y agoDunno, it's fairly obvious what you're working with, being explicit doesn't buy that much (for me at any rate). val persons = names.map(Person.apply). filter(_.isValid)