title: Drools - check if exists/contains string in a List<String>
body: <p>I need to create a rule to check if a part of string exists inside a List[String]. Is there a way that i could do it?</p>
  
  <p>I'm trying using <strong>contains</strong> but it's not working.</p>
  
  <pre><code>rule "New Assistance"
      when
          $room:Room($tags : tags)
          //$room:Room(tags contains "protocol")
          $value:String() from $tags
          //Boolean(booleanValue == true) from $value == "protocol"
          Boolean(booleanValue == true) from $value.contains("protocol")
      then
          System.out.println("Error");
  end
  </code></pre>
  
  <p>And here is my code </p>
  
  <pre><code>...
  val room = new Room(null, List[User](), List[Message](message), 
              new Date, null, List[String]("protocol"))
  kieSession.insert(room)
  kieSession.fireAllRules()
  ....
  </code></pre>
  
  <p>Thanks!</p>
  
  <p>// tests java</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.List;
  
  public class Test { 
      public static void main(String[] args) {    
          List&lt;String&gt; tags = new ArrayList&lt;&gt;();
          tags.add("protocol");
          Room room = new Room(tags);
          System.out.println(room.tags.contains("protocol") );        
      }   
  }
  
  class Room {        
      public List&lt;String&gt; tags;
  
      public Room(List&lt;String&gt; tags){
          this.tags = tags;
      }   
  }
  </code></pre>
  
  <p>// tests scala</p>
  
  <pre><code>val room = new Room(null, List[User](), List[Message](message), 
              new Date, null, List[String]("protocol"))
  
  var xx = room.tags.contains("protocol")
  </code></pre>
  
  <p>Both returns <strong>true</strong>.</p>