public Optional < Tree < T > > commonParent ( Tree < T > other ) { List < Tree < T >> myParents = parents ( ) . startWith ( this ) . toList ( ) . blockingGet ( ) ; return other . parents ( ) . startWith ( other ) . filter ( myParents :: contains ) . map ( Optional :: of ) . blockingFirst ( Optional . empty ( ) ) ; }
Get the first common parent of this node and the given node