Question: ```
ArrayList searchList = new ArrayList();
ArrayList words=(ArrayList) request.getSession().getAttribute("words");
words.add("one");
words.add("twenty one");
words.add("thirty one");
words.add("two");
words.add("twenty two");
words.add("thirty two");
words.add("three");
words.add("twenty three");
words.add("thirty three");'

```

If I have this arraylist and I want to search all the strings containing one(i.e. one,twenty one and thirty one), what logic should I use? Means how should I do that?

Answer: 
```
for (String word : words) {
   if (word.contains("one")) {
       //we have a match
   }
}

```
Of course you have to loop thru the elements. Look for ways to loop thru an ArrayList: that can be indexed or with the 

```
for (x : collect) 

```

notation. 

In the loop you have to do some pattern matching. Read String Java API doc for a method.

(Give'em some think food ...)