消費(fèi)型接口: Consumer< T> void accept(T t)有參數(shù),無(wú)返回值的抽象方法;

供給型接口: Supplier < T> T get() 無(wú)參有返回值的抽象方法;
以stream().collect(Collector collector)為例:
比如:

斷定型接口:Predicate boolean test(T t):有參,但是返回值類(lèi)型是固定的boolean
比如: steam().filter()中參數(shù)就是Predicate

函數(shù)型接口: Function R apply(T t)有參有返回值的抽象方法;
比如: steam().map() 中參數(shù)就是Function;reduce()中參數(shù)BinaryOperator(ps: BinaryOperatorextends BiFunction)


京公網(wǎng)安備 11010802030320號(hào)