Antoine Gagnon
04/28/2020, 1:52 PM(1..10).filter {
it < 5
}
.map {
val double = it * 2
double*3
}
.map {
it.dec()
it + 5
}
2.
(1..10).filter {
it < 5
}.map {
val double = it * 2
double * 3
}.map {
it.dec()
it + 5
}
The coding convention suggests that when chaining calls you should put each call on a new line starting with a dot but I don’t how if it applies to lambdas and other {} thingsDavid Eriksson
04/28/2020, 1:53 PMDominik wuttke
04/28/2020, 1:53 PMflosch
04/28/2020, 1:54 PM(1..10).filter { it < 5 }
.map {
val double = it * 2
double * 3
}
.map {
it.dec()
it + 5
}
is what I would go forDavid Eriksson
04/28/2020, 1:56 PMAntoine Gagnon
04/28/2020, 2:00 PMsindrenm
04/28/2020, 2:01 PM.filter
down:
(1..10)
.filter { it < 5 }
.map {
val double = it * 2
double*3
}
.map {
it.dec()
it + 5
}
David Eriksson
04/28/2020, 2:01 PMsindrenm
04/28/2020, 2:02 PMDavid Eriksson
04/28/2020, 2:02 PMCasey Brooks
04/28/2020, 2:13 PM;
to separate them so they can stay on a single line. I try to make the call chains each take only a single line, either by condensing into one line or extracting to a named function
(1..10)
.filter { it < 5 }
.map { val double = it * 2; double*3 }
.map { it.dec(); it + 5 }
Antoine Gagnon
04/28/2020, 2:14 PMCasey Brooks
04/28/2020, 2:19 PMAntoine Gagnon
04/28/2020, 2:20 PMArkadii Ivanov
04/28/2020, 10:16 PM(1..10)
.filter { it < 5 }
.map {
val double = it * 2
double * 3
}
.map {
it.dec()
it + 5
}
I would go with this variant