<@U0BFDUP0E> this is java way and it works `return...
# announcements
t
@jw this is java way and it works
return list.stream().allMatch(new HashSet<>()::add);
i
And the equivalent in Kotlin would be:
Copy code
listOf(1,2,3,1,2,3).all(HashSet<Int>()::add)
t
@ilya.gorbunov unfortunately, this code can’t get compiled
i
Do you use Kotlin 1.1.x?
t
ah, yeah, sorry it works as initially i used
{}
instead of
()
Thanks
But curiosity, why the following code behaves different,
listOf(1,2,3,1,2,3).all { HashSet<Int>().add(it) }
Ok, got it, stupid conversion tool, it’s a bug of that