What is the best way to filter a Java Collection?

后端 未结 27 3337
故里飘歌
故里飘歌 2020-11-21 06:55

I want to filter a java.util.Collection based on a predicate.

27条回答
  •  独厮守ぢ
    2020-11-21 07:33

    Are you sure you want to filter the Collection itself, rather than an iterator?

    see org.apache.commons.collections.iterators.FilterIterator

    or using version 4 of apache commons org.apache.commons.collections4.iterators.FilterIterator

提交回复
热议问题