public GameObject FindAndRemove(T toRemove, U findHelper) //finds a flower with the same pos and re { if (head == null) //if there's no data { return(null); } if (head.data.CompareTo(toRemove) == 0)//is this the data { if (head.data == null) { int a = 9; } GameObject toReturn = head.data.gameObject; head = this.head.next; return(toReturn); } return(head.FindAndRemove(toRemove, findHelper));//pass }
public GameObject FindAndRemove(T toRemove, U findHelper) //finds and removes { if (next != null) //if can check next { if (next.data.CompareTo(toRemove) == 0) //is it it { GameObject toReturn = next.data.gameObject; next = next.next;//remove return(toReturn); } if (compareable.CompareTo(findHelper) > 0)//if the findhelper is too large then we have overshot the data and it's not here { return(null); } return(next.FindAndRemove(toRemove, findHelper));//check next } return(null); }