Library method to partition a collection by a predicate

前端 未结 6 730
小鲜肉
小鲜肉 2020-12-29 21:02

I have a collection of objects that I would like to partition into two collections, one of which passes a predicate and one of which fails a predicate. I was hoping there wo

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-29 21:52

    Apache Commons Collections IterableUtils provides methods for partitioning Iterable objects based on one or more predicates. (Look for the partition(...) methods.)

提交回复
热议问题