You are viewing a single comment's thread. Return to all comments →
Use stream and lambdas
import java.util.List; import java.util.Scanner; import java.util.stream.Collectors; import java.util.stream.Stream; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); List<Integer> list = Stream.generate(scanner::nextInt).limit(n).collect(Collectors.toList()); list.forEach(System.out::println); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Java 1D Array
You are viewing a single comment's thread. Return to all comments →
Use stream and lambdas