Fixes #718#746
Conversation
ilya-khadykin
left a comment
There was a problem hiding this comment.
We should investigate why build has failed
| .map(this::translateWord) | ||
| .collect(Collectors.toList()); | ||
|
|
||
| return String.join(" ", translatedWords); |
There was a problem hiding this comment.
It would be even better to get rid of this line:
String.join(" ", translatedWords);with
.collect(Collectors.joining(" "));There was a problem hiding this comment.
Good suggestion @m-a-ge :) So @matthewstyler you could get rid of the last line and change this to
String translate(String sentence) {
return Arrays.stream(sentence.split(" "))
.map(this::translateWord)
.collect(Collectors.joining(" "));
}
If you want to :) It's good as it is though, so don't feel like you have to! :)
|
|
||
| String translate(String sentence) { | ||
| List<String> translatedWords = Arrays.stream(sentence.split(" ")) | ||
| .map(this::translateWord) |
There was a problem hiding this comment.
Probably:
.map(PigLatinTranslator::translateWord)There was a problem hiding this comment.
It's an instance method not a static method so it should be this::translateWord :)
|
taking a look at the build logs, seems like the PigTranslator isn't the issue: |
|
Yeah, that timeout was weird. Restarting the build to see what happens! |
FridaTveit
left a comment
There was a problem hiding this comment.
Thanks @matthewstyler, this looks great! :D
There's one further improvement that @m-a-ge suggested that you could address in this PR if you want to :) But if you don't want to then don't worry about it, I can open a new issue for it :)
|
|
||
| String translate(String sentence) { | ||
| List<String> translatedWords = Arrays.stream(sentence.split(" ")) | ||
| .map(this::translateWord) |
There was a problem hiding this comment.
It's an instance method not a static method so it should be this::translateWord :)
| .map(this::translateWord) | ||
| .collect(Collectors.toList()); | ||
|
|
||
| return String.join(" ", translatedWords); |
There was a problem hiding this comment.
Good suggestion @m-a-ge :) So @matthewstyler you could get rid of the last line and change this to
String translate(String sentence) {
return Arrays.stream(sentence.split(" "))
.map(this::translateWord)
.collect(Collectors.joining(" "));
}
If you want to :) It's good as it is though, so don't feel like you have to! :)
|
@m-a-ge & @FridaTveit made that change |
FridaTveit
left a comment
There was a problem hiding this comment.
Brilliant! Thank you @matthewstyler! :)
And thanks @m-a-ge for the suggested improvement :) The code looks much neater now thanks to you two :)
tighten access modifier and method invocations
Reviewer Resources:
Track Policies