خرید بک لینک

Vote count: 0

In this question it has already been answered that both expressions are equal, but in this case they produce different results. For a given int[] scores, why does this work:

Arrays.stream(scores)
        .forEach(System.out::println);

...but this does not:

Arrays.asList(scores).stream()
        .forEach(System.out::println);

As far as I know .stream() can be called on any Collection, which Lists definitely are. The second code snippet just retus a stream containing the array as a whole instead of the elements.

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 27 ارديبهشت 1395 ساعت: 18:24

صفحه بندی