title: Iterating over list of strings to see if particular string is present in all strings in the list (Java/Groovy)
body: <p>I have a list of strings (that I'm getting from another method) and want to verify that a certain string is present in ALL of the strings. I.e if the list is ["My name is Lindsey", "My name is Billy, "My name is John"] and I am testing to see if "name" is present in all strings, the method should return true. But if the list is ["My name is Lindsey", "My name is Billy, "I'm John"], the method should return false because "name" isn't in the last string. (I'm really new to programming, I apologize if I'm not using the right terms/symbology). Anyway, here is what I currently have:</p>
  
  <pre><code>def verifyEachSuggestionContainsValueOf(String value) {
          List&lt;String&gt; customerMessageSuggestions = customerMessageAutoSuggestions()
          boolean stringPresent = false
          for (String suggestion : customerMessageSuggestions) {
              if (suggestion.contains(value)) {
                  stringPresent = true
              }else{
                  return false
              }
          }
          return stringPresent
      }
  </code></pre>
  
  <p>This works, but I feel like there has to be a cleaner way of doing it. Any suggestions would be greatly appreciated. Thank you!</p>
  
  <p>***Edited to fix issue with stringPresent being returned inside For loop.</p>