Producer와 consumer wildcard

값을 읽는지 넣는지에 따라 허용 연산이 달라진다.

List<? extends Animal>

Animal로 읽기

producer

List<? super Dog>

Dog 넣기

consumer

Function input

super

consumer

Function output

extends

producer
기억PECS는 방향 설명이며 모든 signature에 wildcard를 넣으라는 규칙이 아니다.

핵심: private helper는 단순 type parameter만으로 충분할 수 있다.