首先,我们先定义一个函数式编程接口 @FunctionalInterface public interface BooleanFunctionalInterface<T> { boolean test(T t); } 很简单,该接口的唯一一个抽象方法(并且非Object方法)返回值为boolean 下面,定义一个方法,接受一个List,利用实现了该接口的test方法的对象,筛选出需要的元素: import org.springframework.util.CollectionUtils; im…