I have this boolean function:
public boolean remove(T elem){
boolean ezabatu = false;
if (this.first.equals(elem)){
this.removeFirst();
ezabatu = true;
}else{
while (this.actual.next!=null && !ezabatu){
if(this.actual.next.equals(elem)){
this.remove();
ezabatu = true;
}
this.actual = this.actual.next;
}
}
this.actual = this.first;
return ezabatu;
}
and I use it here:
int elem = teklatu.nextInt();
if(osokoLista.remove(elem)){
System.out.println(...);
}else{
System.out.println(...);
}
in the if I get the error "can not convert from Integer to boolean" and I do not understand why