Find trusted answers to your questions with the help of IDNLearn.com's knowledgeable community. Discover comprehensive answers to your questions from our community of knowledgeable experts.
Answer:
Initialize the “longest word” by an empty string and update it when a longer word is found
Explanation:
import java.util.stream.Stream;
public static String findLongest(String[] spellingList) {
return Stream.of(spellingList).reduce("", (longestWord, word) -> (
longestWord.length() < word.length() ? word : longestWord
));
}