Why can't I pass an object of type T to a method on an object of type <? extends T>?
- by Matt
In Java, assume I have the following class Container that contains a list of class Items:
public class Container<T>
{
private List<Item<? extends T>> items;
private T value;
public Container(T value)
{
this.value = value;
}
public void addItem(Item item)
{
items.add(item);
}
…