for 内包表記を同等の flatMapmapwithFilter、および foreach の呼び出しに置換します。