> The advantage over List<Object> is the ability to assigned the ability to 
> just any List<N>.
> If we use List<Object> we need to copy another object just overcome this 
> issue. If we need to maintain object identity, this approach is not 
> appropriate. Then we will be stuck.

Right - that's why we return List<?> from getListData(). But as you noted, 
defining the method as follows doesn't really help ensure compile-time type 
safety:

public <T> List<T> getListData() { ... }

It simply helps to avoid casting the return type to List<Foo> in order to 
modify the list.

G




Reply via email to