I want to remove the required values(int) in a linked list. For example, {3,1,2,3,3}. I use remove(int 3), then it should be {1,2}. Can you help me, my code can just remove the 3 in the index 0, but I still need to remove the index 3 and 4.
public void remove(int value) {
    IntegerNode curr = head;
    IntegerNode prev = null;
    for(curr = head; curr != null; curr = curr.next) {
        if(curr.item == value) {
            break;
        }
        prev = curr;
    }
    if(prev == null) {
        head = curr.next;
    } else {
        prev.next = curr.next;
    }
    count--;
}
 
     
     
     
     
     
     
    