How can `filter {}.isEmpty()` be simplified? IDE i...
# getting-started
m
How can
filter {}.isEmpty()
be simplified? IDE is complaining that it can be
s
use
.any {}
3
all you care about is if you can find any element in your collection that matches that predicate, right?
r
I think in this case it would be
.none {}
👍 2
s
none is also good if you need the opposite
m
Actually,
all
is what I want for this specific case, but thanks for getting me thinking along the right tracks!
p
the IDE can often suggest a solution in cases like this. on OSX you can press option+enter, not sure about windows but the shortcut should show up as “show intention actions”
h
on windows it's alt+enter by default
🙂 1
m
Yeah, it couldn't for this one for whatever reason
🤔 1
s
I get a useful-looking popover on my machine prompting me to merge the chain call (edit: inb4 someone says “use
.startsWith()
)
shrung, chalk it up to IDE weirdness I guess
h
use
.startsWith()
🤣 3
🆗 2
I'm sorry. you made me do it..