Google Collections (Guava Libraries): ImmutableSet/List/Map and Filtering
问题 Assume that you want to build a copy of an ImmutableSet / List / Map object but filter out some of the original entries. One way to implement that is the following: ImmutableList.copyOf(Iterables.filter(myObject, myObject.EQUALS)); where myObject.EQUALS is a predicate for the Iterables.filter() operation. I think this is a pretty elegant and easy-to-read implementation. However, one builds two list objects (first through the Iterables.filter(...) call, second through ImmutableList.copyOf(...)