title: How to filter value in next line in Kotlin
body: <p>Hey I am working in list of object. I want to iterate whole object one by one and print every index value in each line. I tried some code but I am not getting the proper output.</p>
  <p><strong>StringPrint.kt</strong></p>
  <pre><code>fun main() {
      val newString = createData().joinToString(&quot;\n&quot;) { &quot;${it.title?: &quot;&quot;} ${it.status?: &quot;&quot;}&quot;.trim() }
      println(newString)
  }
  
  data class Event(val title: String? = null, val status: String? = null)
  
  fun createData() = listOf(
      Event(&quot;text 1&quot;, &quot;abc&quot;),
      Event(&quot;text 2&quot;, &quot;abc&quot;),
      Event(&quot;text 3&quot;, &quot;abc&quot;),
      Event(&quot;text 4&quot;, &quot;abc&quot;),
      Event(&quot;&quot;, null),
      Event(null, &quot;&quot;),
      Event(null, &quot;3&quot;),
      Event(&quot;null&quot;, &quot;&quot;),
      Event(&quot;456&quot;, &quot;89&quot;)
  )
  </code></pre>
  <p><strong>output</strong></p>
  <pre><code>text 1 abc
  text 2 abc
  text 3 abc
  text 4 abc
  Space Space
  Space Space
  3
  null
  456 89
  </code></pre>
  <p>As you can see in output I added <strong>space keyword</strong> which means there is whiteSpace character is present and <strong>null</strong>. I don't want all these.</p>
  <p><a href="https://i.stack.imgur.com/BjB4r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BjB4r.png" alt="enter image description here" /></a></p>
  <p>E<strong>xpected Output</strong></p>
  <pre><code>text 1 abc
  text 2 abc
  text 3 abc
  text 4 abc
  3
  456 89
  </code></pre>
  <p>After @lukas.j suggestion I tried this</p>
  <pre><code>val newString = createData()
          .filterNot { it.title.isNullOrBlank() || it.status.isNullOrBlank() }
          .joinToString(&quot;\n&quot;) { &quot;${it.title?: &quot;&quot;} ${it.status?: &quot;&quot;}&quot;.trim() }
   println(newString)
  </code></pre>
  <p><strong>Output.kt</strong></p>
  <pre><code>text 1 abc
  text 2 abc
  text 3 abc
  text 4 abc
  456 89
  </code></pre>
  <p>it's not printing value 3 in console.</p>