Find if an element with a specific property value is found in a list

If you need that the element is exactly one:

t.filter { it.retailerId == value }.size == 1

if not:

t.any { it.retailerId == value }

With foldRight and a break when you found it:

t.foldRight(false) {val, res ->
                if(it.retailerId == value) {
                    return@foldRight true
                } else {
                    res
                }
            }

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)