Search code examples
kotlinkotlin-null-safety

Null safetly check kotlin formating


I'm fairly new to Kotlin and I am not familiar with the best practice for scoping functions or null checks. How do i rewrite this null check in a clearer way?

return item.feed != null 
    && item.feed.subject != null 
    && item.feed.subject == subject.trim())

Solution

  • Also see this diagram:

    enter image description here

    source: typealias.com