List<String> list = stream.collect(Collectors.toList()); list.sort(null); return list.toArray(new String[list.size()]);Could be converted to
return stream.sorted().toArray(String[]::new);
Note that sometimes converted stream chain may replace explicit ArrayList with Collectors.toList() or explicit HashSet with Collectors.toSet(). While current library implementation uses these collections internally, this is not specified, thus can be changed in future possibly changing the semantics of your code. If you are concerned about this, use the checkbox below to suppress usages of toList and toSet collectors. In this case Collectors.toCollection() will be suggested instead.
New in 2017.3