var numbers = List.of(0,1,2,3,4,5,6,7,8,9);
You want to calculate the average of numbers.
Which two codes will accomplish this? (Choose two.)
var numbers = List.of(0,1,2,3,4,5,6,7,8,9);
You want to calculate the average of numbers.
Which two codes will accomplish this? (Choose two.)
To calculate the average of a list of numbers using Java streams, we need to convert the list to a stream and use appropriate methods to compute the average. Option B uses 'parallelStream()', maps the elements to integers, and then calculates the average correctly using '.average().getAsDouble()'. Option E correctly uses 'stream().collect(Collectors.averagingDouble(n -> n))' to collect the stream and compute the average as a double. These two codes will accomplish the task correctly.
B,E is true