Suppose we have an interface:
public interface MyInterface<Key>
{
Key getKey();
}
Then we got two classes:
public class ClassWithString implements MyInterface<String>
{....................}
public class ClassWithInteger implements MyInterface<Integer>
{....................}
How to make something like this:
public static Map convert(List<? extends MyInterfac<K>> list)
{
.....
}
Actually I need a method that
- can work with lists.
Elements of the list has to extend MyInterface with parameter. How to make that parameter?:
(List<? extends MyInterfac<K>> list)
Of course convert method wouldn't run, I just wish to implement something like that.