자바 함수형 인터페이스2 Java - 함수형 인터페이스(Predicate) 합성 and(), or(), negate()로 두 Predicate를 하나로 합성할 수 있다. Predicate p = i -> i i i%2 == 0; Predicate notP = p.negate(); // i >= 10 Predicate all = notP.and(q).or(r); // 10 2017. 3. 1. Java - 기본형을 사용하는 함수형 인터페이스 인터페이스 메서드 설명 DoubleToIntFunction int applyAsInt(double d) aTobFunction a는 입력 b는 리턴 ToIntFunction int applyAsInt(T d) ToaFunction a는 입력 리턴은 제네릭 IntFunction T applyAsInt(int d) aFunction 리턴이 제네릭 ObjIntCunsumer void applyAsInt(T d, int i) 입력에 제네릭, int 리턴은 없다 Supplier s = ()->(int)(Math.random()*100); static void makeRandomList(Supplier s, List list) { for(int i=0;i(int)(Math.random()*100); static v.. 2017. 2. 27. 이전 1 다음