I'm implementing arrayList with array and jumped into a problem with the Object type of data.
this is my indexOf method which runs normally
public int indexOf(Object item) {
int index = -1;
for (int i = 0; i < capacity; i++) {
if (arrayList[i] == item) {
index = i;
}
}
return index;
}
but if i have an int number like '1444' in my list and try to run list.indexOf(1444);
the method can't find it's index. If I add at the same index another lesser number or a string or anything else it works normally. also I don't have any restrictions about the int type in my code.