Bar가 단일 메소드에서만 사용되는 경우에도이 시나리오의 전체 인터페이스를 매개 변수화해야합니까?Java generics - 메소드 매개 변수
public interface IFoo<T>{
void method1(Bar<T> bar);
//Many other methods that don't use Bar....
}
public class Foo1 implements IFoo<Yellow>{
void method1(Bar<Yellow> bar){...};
//Many other methods that don't use Bar....
}
public class Foo2 implements IFoo<Green>{
void method1(Bar<Green> bar){...};
//Many other methods that don't use Bar....
}
+1 좋은 코드 샘플은 독자를 도울 수 있습니다 ... – KLE