Guava小功能收集
List<Integer> numbers = Lists.newArrayList(1, 2, 3, 6);Predicate<Integer> acceptEvenNumber = new Predicate<Integer>() { @Override public boolean apply(Integer number) { return (number % 2) == 0; }};Function<Integer, Boolean> isEventNumberFunction = Functions.forPredicate(acceptEvenNumber);List<Boolean> areNumbersEven = Lists.transform(numbers, isEventNumberFunction); assertThat(areNumbersEven, contains(false, true, false, true));