In Java 9 we can use takeWhile as in the example below to print all the numbers less than 10. IntStream .iterate(1, n -> n + 1).
確定! 回上一頁