I have an array,. I would like to do this ideally:private T[] elements;
if(elements[index] == null){ elements[index] = 0; } elements[index] = elements[index] + 1;
But I get the error of "cannot cast from int to T." How can I check my array for a null space and change it to zero if null is encountered (and then increment the 0 to 1)?