Wednesday, 28 August 2013

How to give the And condition in Generics in java

How to give the And condition in Generics in java

This question was asked to me in an interview.
We have a class strcture like A<-B<-C<-D<-E<-F(B extends A, C extends B
and so on).
So i need to create a method acceptList(List<> list) in such a way that it
can accept the List of Class A,C,E and do not accept List of B,D,F.
Kindly help

No comments:

Post a Comment