I have an Option of a Seq of some items:
Option[Seq[MyItem]]
MyItem has a field 'description'
I need to find whether one of the items has a specific description.
How can it be done using for comprehension?
CodePudding user response:
If you want to test whether any element of Option[Seq[MyItem]]
has a specific description then you can do this.
opt.exists(_.exists(_.description == ???))
If you really need a solution that uses for
then I can't help you :)