Write ArrayList's remove() method