title: Handle Kotlin Filter Predicate multiple inner condition
body: <p>In the below list of custom objects, I wanted to implement filtering based on some condition by comparing values in ViewModel class</p>
  
  <p>My list would be like this</p>
  
  <pre><code>var inputList: MutableList&lt;Person&gt;
  </code></pre>
  
  <p>Person data class is like follows</p>
  
  <pre><code>data class Person(val inContact: Boolean, val age: Int, val isFavourite:Boolean .......)
  </code></pre>
  
  <p>Filtering based on condition:</p>
  
  <pre><code>val fav = mViewModel.personInContact.value //TRUE or FALSE
  val personAge = mViewModel.personAge.value // INT VALUE
  </code></pre>
  
  <p>Now I wanted to consider <code>inContact</code> only if <code>fav</code> is <code>true</code>. </p>
  
  <p>If <code>fav</code> is <code>false</code>, I do not want to consider <code>inContact</code> at all.</p>
  
  <p>So if the filtering list logic is like this, it will always consider <code>fav</code> condition.</p>
  
  <pre><code>val filteredFinalList = inputList.filter{
  
              (it. inContact == fav)//how to ignore this check based on fav's value?
  
              &amp;&amp;
  
              (it.age &gt;=  personAge)
  
              &amp;&amp; SOME OTHER CONDITIONS PRESENT AS WELL
  }
  </code></pre>
  
  <p>How can I consider <code>(it. inContact == fav)</code> if only <code>fav</code> is <code>true</code> and <strong>avoid</strong> if <code>fav</code> is <code>false</code> in <code>inputList.filter</code> ?</p>