我有这样的事情:
public interface A<I>{
public I[] returnAll();
}
public class B implements A<Integer>{
public Integer[] returnAll(){
return new int[] //return Type has to be Integer[]
}
}
Run Code Online (Sandbox Code Playgroud)
我知道Integer并且int有所不同,因为它int是原始的,我也知道我不能int因为同样的原因而使用Generic.
仍然有一个简单的方法来改变泛型,以便我可以返回int[]?