람다 인터페이스들
Predicate<T>
- boolean test(T value)
Predicate의 친구들
IntPredicate
- boolean test(int value)
LongPredicate
- boolean test(long value)
DoublePredicate
- boolean test(double value)
BiPredicate<T, U>
- boolean test(T t, U u)
위 세가지 방식은 기본 자료형에 대해서 Predicate<T>를 사용하게 되면 Integer 등으로 박싱하고 연산할 때 언박싱하는 불필요한 연산이 추가된다는 점을 해소하기 위함
BiPredicate는 값 두개를 입력받는 Predicate
Supplier<T>
- T get();
getter의 일반화
IntSupplier
- int getAsInt()
LongSupplier
- long getAsLong()
DoubleSupplier
- double getAsDouble()
BooleanSupplier
- boolean getAsBoolean()
Consumer<T>
- void accept(T t);
소비자
반환값 X, 입력 O
DoubleConsumer
- void accept(double value)
ObjDoubleConsumer<T>
- void accept(T t, double value)
BiConsumer<T, U>
- void accept(T t, U u)
Function<T,R>
- R apply(T t);
T는 입력, R은 출력
친구가 엄청 많다
친구들 이름 패턴
1. A To B : A는 입력 B는 출력
2. A Unary : 입력, 출력 둘 다 A
3. Bi : 입력이 두개
4. A : 입력이 A
5. ToA : 출력이 A
추가
1. UnaryOperator<T> T apply(T t)
2. BinaryOperator<T> T apply(T t1, T t2)