Skip to content

Conversation

@daadaadaah
Copy link
Owner

No description provided.

- ApplePredicate 객체에 의해 filterApples 메서드의 동작이 결정된다.
- 즉, filterApples 메서드의 동작을 파라미터화한 것이다.
- 현재 filterApples 메서드로 새로운 동작을 전달하려면 ApplePredicate 인터페이스를 구혀나는 여러 클래스를 정의한 다음에 인스턴스화 해야 한다. 이는 상당히 번거로운 작업이다.
- 만약, 익명 클래스를 사용하면 클래스 선언과 인스턴스화를 동시할 수 있어, 즉석에서 필욯나 구현을 만들어서 사용할 수 있는 장점이 있다.
- 사과 뿐만 아니라 바나나, 정수 등의 리스트에 필터 메서드를 사용
- 이렇게 유연함과 간결한 코드가 완성되었다!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants