I have an `Arraylist` which I have populated with strings.

```
ArrayList<String> urls = new ArrayList<>();

```

Below is an example of one of the strings.

`http://asite.com/some-stuff-qua-sta/api/xml`

I have then created an `Iterator`to loop through them. This issue is I have items in the array I don't want. an example of this would be:

`http://asite.com/some-stuff-test-sta/api/xml`

Because it contains "test" I want to exclude this from the Arraylist so I added a line like this.

```
urls.remove();

```

This doesn't work so I tried to add something like this when populating the `Arraylist`.

```
!e.getElementsByTagName("name").item(0).getTextContent().contains("test");

```

This also doesn't work. Can someone suggest a good method to do this?