val list = List[Foo]()
val found: Option[Foo] = list find { each => ... }
Also stops looping after the first hit.
Am Montag, 15. Juni 2015 08:23:13 UTC+2 schrieb Maks Atygaev:
Hi!
I have the below code:
var f = false
collection foreach { item => {
if ( ... ) {
f = true
}
... ... ...
}}
if (f) {
... ...
}
Is it possible to make it more functional way? Should I refactor it?
--I have the below code:
var f = false
collection foreach { item => {
if ( ... ) {
f = true
}
... ... ...
}}
if (f) {
... ...
}
Is it possible to make it more functional way? Should I refactor it?
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.