Reputation: 191
public static<T> int getUsedSlotsSize(T[] arr)
{
int index = 0;
while(arr[index] != null)
index++;
return index + 1;
}
int a = getUsedSlotsSize(arr);
eclipse tells me to change the method parameter arr to byte[]
What am I doing wrong?
Upvotes: 1
Views: 47
Reputation: 643
Your code does not show which type is used for arr
within getUsedSlotsSize(arr)
.
If you are using
byte[] arr = new byte(anySize);
int a = getUsedSlotsSize(arr);
then you have to change the type of your array into Byte[]
as mentioned in the comments.
Byte[] arr = new Byte(anySize);
int a = getUsedSlotsSize(arr);
Upvotes: 1