<p>I need to see if a string value matches with an object value, but why won't this work?</p>

<pre><code>public int countPacks(String flavour) {
    int counter = 0;
    for(int index = 0; index &lt; packets.size(); index++) {            
        if (packets.equals(flavour)) {
           counter ++;
        }
        else {
           System.out.println("You have not entered a correct flavour");
        }
    } 
    return counter; 
}
</code></pre>

You probably mean something like
```
```
if (packets.get(index).equals(flavour)) {
   ...
```
```