Hey guys! I’m doing something like this ``` ...
# intellij
b
Hey guys! I’m doing something like this
Copy code
val resolutions = mutableListOf<Source>()
        for (apiSource in apiModel.resolutions) {
            resolutions += ApiSourceConverter.convert(apiSource)
        }
which could be easily refactored using
map { }
, and I’m pretty sure I’ve seen in the past that AS automatically suggested it. I’m currently using IntelliJ Idea and there’s no suggestion. Have I dreamed, or is this a bug, or is this an AS only feature? Thanks!
s
nope, intellij should also offer a similar refactor intention
b
😞 Any idea what could cause it to not work?
s
I guess I haven’t tried it out recently, but perhaps they’re being more conservative about determining what is or isn’t a semantic change now
actually, no, I get the correct intention if I hit
alt+enter
with the caret on the for-loop
s

https://i.imgur.com/6t0pSjt.png

is what I get, but perhaps I got some of the types wrong
b
weird. I’ll try the beta channel 🙂
s
🤔 dunno about that, I’m on stable and it’s working fine
oh, I know what I did differently
why are you using
+=
rather than
.add(E)
?
b
haha I don’t know, I think it’s cooler I guess 😛 But I’ve tried with
add
and still don’t have the intention
s
er, not to chide you or anything 😅 I’m just wondering
b
no worries!
wait you’re right! I have it
s
🎉
b
haha 🙂 It’s just that I’m pretty sure it was actually a warning in AS - so more visible
but maybe I’m thinking of something else
s
¯\_(ツ)_/¯
at least we solved this particular mystery
b
haha 🙂 Many thanks any way
👍 1
yeah
ok found the culprit, it’s just a different setting in AS than in IJ (I guess Google customized the defaults). In IJ: https://www.dropbox.com/s/gvzshpamgbfpuyx/Screenshot%202018-03-10%2023.46.59.png?dl=0 / in AS: https://www.dropbox.com/s/r2rk290osxq8vwo/Screenshot%202018-03-10%2023.49.02.png?dl=0