https://kotlinlang.org logo
#announcements
Title
# announcements
s

silas.schwarz

08/01/2017, 8:24 PM
Copy code
class Hi(val something : String, val filter : (String) -> Boolean = {true}){

    fun letsHaveSomeFun() : String? {
        when(filter(something)){
            true-> return something
            false -> return null
        }
    }

}
r

Ruckus

08/01/2017, 8:28 PM
fun letsHaveSomeFun() = something.takeWhen(filter)
4 Views