# 부록 1. 함수형 인터페이스의 집합

우리가 친숙해져야 할 인터페이스들의 집합에 대해 알아보도록 하자 여기서 살펴볼 모든 인터페이스는 java.util.function 패키지에 속해있다.

### Consumer\<T>

* 추상 메서드 : accept()
* 디폴트 메서드 : andThen()
* 일반적인 사용법 : forEach() 메서드의 파라미터로 사용
* 원시 타입과 함께 사용하는 경우 : IntConsumer, LongConsumer, DoubleConsumer

### Supplier\<T>

* 추상 메서드 : get()
* 디폴트 메서드 : -
* 일반적인 사용법 : 레이지 무한(infinite) Stream을 생성하고 Optional 클래스의 orElseGet() 메서드의 파라미터로 사용
* 원시 타입과 함께 사용하는 경우 : IntSupplier, LongSupplier, DoubleSupplier

### Predicate\<T>

* 추상 메서드 : test()
* 디폴트 메서드 : and(), negate() 그리고 or()
* 일반적인 사용법 : filter()와 anyMatch()와 같은 Stream 메서드의 파라미터로 사용됨
* 원시 타입과 함께 사용하는 경우 : IntPredicate, LongPredicate, DoublePredicate

### Function\<T,R>

* 추상 메서드 : apply()
* 디폴트 메서드 : andThen(), Compose()
* 일반적인 사용법 : Stream의 Map() 메서드의 파라미터로 사용됨
* 원시 타입과 함께 사용하는 경우 : IntFunction, LongFunction, DoubleFunction, IntToDoubleFunction, DoubleToIntFunction


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://incheol-jung.gitbook.io/docs/study/functional-programming-in-java-8/1..md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
