Add a method to check the end iterator