📜  java 初始化布尔值的动态数组 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:14.753000             🧑  作者: Mango

代码示例1
// Load List of Boooleans, from console, using streams:
List booleans = Arrays
                .stream(scanner.nextLine().split("\\s+"))
                .map(Boolean::parseBoolean)
                .collect(Collectors.toList());


// Load ArrayList of Boooleans, from console, using streams:
ArrayList booleans = new ArrayList<>();
while (scanner.hasNextBoolean()) {
  booleans.add(scanner.nextBoolean());
}