Less smart simplifications after loop-to-stream (keep stream)

This commit is contained in:
Tagir Valeev
2018-05-13 18:10:54 +07:00
parent bb74d19e31
commit b336e70485
5 changed files with 46 additions and 5 deletions
@@ -4,6 +4,6 @@ import java.util.*;
public class Main {
private void test(List<String> strs) {
String[] arr = strs.toArray();
String[] arr = strs.stream().toArray();
}
}
@@ -5,7 +5,7 @@ import java.util.List;
public class Test {
public void test(List<List<String>> list) {
List<?>[] arr = list.toArray(new List[0]);
List<?>[] arr = list.stream().toArray(List[]::new);
System.out.println(Arrays.toString(arr));
}
}