If it were a regular array, I could just create a new array and then make arraycopy, but generics will not let me do this. The best I've come up with so far:
public void resize() {
T[] tempArray = Arrays.copyOf(myArray,myArray.length*3);
}
It compiles, but at runtime I get a null pointer exception. Can someone explain what I'm doing wrong?
source
share