 Alright, so now we're going to take a look at how we can remove an item from a customer rail list by calling this remove method. And what this method does is it takes one parameter, idx, which is the index of the item that we want to remove. It then removes the item and then returns said item. Now an important note here, in this example, our return type is of object type double rather than of primitive data type double. The reason we've chosen the object type double as our return type is so that we have the option to return null in the event that we fail to pass a valid index into our remove function. Now if we had chosen to use the primitive data type double as our return type, then we may have chosen to use zero or negative one as our return values in the event that we failed to pass a valid index. But the problem with this is that zero or negative one may be valid items within our list. In which case returning these values does not clearly indicate that we have failed to pass a valid index and that no value was found at the index past. But if we return null, then this clearly indicates that no value was found. Yeah, so that's why using the object type double as our return type is a lot better and a lot clearer than using the primitive data type double in this example. All right, so taking a look at how this remove method works. So of course, first we check to make sure we've passed a valid index. And if we haven't, then we return null. We then create the field item to remove, which equals idx. So in other words, it just equals data idx. So it just equals the item at the index past. But we then have this for loop for int i equals idx. i is less than n items minus one, i plus plus, data i equals data i plus one. So what this for loop is doing, when we remove an item from our list, we then need to take all of the items above said item in the list and move them down one index in order to fill in the space from the item removed. So you can see here starting from int i equals idx. So i equals the index of the value removed. For every item, data i, it is now going to equal the value at data i plus one. We then decrement n items by one in order to show that we now have one list item in our list, and we then return our removed item. All right, so you can see here I've added a bunch of break points to our method here, and you can see up here I've called the remove method on our previously created list. So let's run this through the debugger so we can see a lot more clearly how this method works. All right, so starting here, so before we move into our remove method, we have the following list, and you can see it contains five values. And what we're going to be doing is we're going to be removing the value at index two, which is 70. So if we step through into our remove method, so you can see first, we're going to check to make sure that the index past is valid. It is, so we're going to move on and create our item to remove field. Our item to remove is 70. So now we're going to step through this for loop. So starting from i equals two, if we step through here, you can see what has happened is i equals two. So index two, data i, data two, now equals data i plus one, which is 30. So now data two has the same value as data i plus one, 30. Now if we step through again, i equals three. So data three equals data i plus one. If we step through, you can see data three. Now equals the value of data i plus one, which was four. So data three and four both have the value of 20. So now we're going to go ahead and decrement our list by one. So in other words, what we're going to do effectively, and items is going to decrement by one. And we're going to remove the final value from our list. And you can see when we do that and when we print our list, we now have a list with the contents 10, 90, 30, and 20. So 70 was removed. So that's just a quick look at how we can utilize the remove method on our custom array list. So I hope you found this helpful and thank you for watching.