Idle pondering from a Scala learner perhaps, but ... in my tinkerings I\'ve written the following:
( n.child.size > 0 ) && ( n.child.filter( ! _.isIns
Starting Scala 2.13, the standard library now provides a chaining operation method pipe fitting exactly this need:
Scala 2.13
import scala.util.chaining._ n.child.pipe(list => list.size > 0 && list.filterNot(_.isInstanceOf[Text]).size == 0)
The value of n.child is "piped" to the function of interest.
n.child