```listOf(1, 2, 3).map { Unit }``` IDE marks `Unit...
# codingconventions
a
Copy code
listOf(1, 2, 3).map { Unit }
IDE marks
Unit
as redundant and proposes to replace it with:
Copy code
listOf(1, 2, 3).map { }
How do you handle this? Proposed fix looks weird to me. This issue occurs quite often in RxJava streams
c
whats the point of doing that ? i dont get it but may be you want
List(3) { Unit }
a
This issue occurs quite often in RxJava streams
For example I have some streams as input and I want to output
Observable<Unit>
after some transformations to the input
m
I've done similar things with RxJava like streams. I've just become accustomed to empty braces meaning unit. Other option is to create an extension methods
mapToUnit
. Then the odd code is only in one place.
👍 1
c
oh ok i missed that last phrase i see... the estension method seems like a good alternative to me 👍
g
Proposed fix looks weird to me.
I add comment in the body of map, though, I would prefer if it would be fixed and { Unit } wouldn’t be marked as warning