gabrielfv
10/11/2017, 7:33 PMval a = foo.computeBar(Baz::class.java).fetchFirst() ?:
return@thisComputationFun
or
val a = foo.computeBar(Baz::class.java).fetchFirst()
?: return@thisComputationFun
or none at all? The IDE has recomended me to do this in place of the classic if (a == null) return@thisComputationFun
diesieben07
10/11/2017, 7:38 PMval a = foo.computeBar(Baz::class.java)
.fetchFirst() ?: return@thisComputationFun
gabrielfv
10/11/2017, 7:42 PMdeviant
10/11/2017, 7:42 PMval a = foo
.computeBar(Baz::class.java)
.fetchFirst()
?: return@thisComputationFun
diesieben07
10/11/2017, 8:03 PMgabrielfv
10/11/2017, 8:06 PMval a = foo.computeBar(Baz::class.java)
.fetchFirst() ?:
return@thisComputationFun
diesieben07
10/11/2017, 8:12 PMgabrielfv
10/11/2017, 8:24 PMval a
it looks like its just returns as well. On a similar level of a .method()
it draws some more attention.bdawg.io
10/12/2017, 6:15 PM.
to invoke a method and ?:
to signal an elvis operation). My vote would be 1. val a = foo.computeBar(Baz::class.java).fetchFirst()
2. ?: return@thisComputationFun
or 1. val a = foo
2. .computeBar(Baz::class.java)
3. .fetchFirst()
4. ?: return@thisComputationFun
(although I agree with intellij about breaking out this logic from your assignment operator)