简体   繁体   中英

Scala - no data foreach after filter

mylist.filter( ~~~ ).foreach( myItem => ~~ )

如果没有通过“过滤器”匹配的数据,是否不执行foreach方法?

执行,它只接收一个空列表( filter的结果)作为输入,因此什么也不做。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM