yogjun / myblog

0 stars 0 forks source link

函数编程 #34

Closed yogjun closed 2 years ago

yogjun commented 4 years ago

1.consumer:接收参数,执行逻辑,无返回值 BiConsumer<Integer,Integer> bc = (p,v) -> {int i = 1;}; bc.andThen(bc).andThen(bc).accept(1,2); 2.Predicate:接收参数,执行逻辑,返回bool Predicate p1 = p -> p.length() > 2; p1.and(p1).and(p1).test("123"); 3.Function:接收参数,执行逻辑,返回自定义值