Question: Consider the below Java program: import java.util. * ; import java.util.stream.Collectors: import java.util.stream.IntStream; public class LambdaDemos public static void main ( String args [ ]

Consider the below Java program:
import java.util.*;
import java.util.stream.Collectors:
import java.util.stream.IntStream;
public class LambdaDemos
public static void main(String args[]){
List aqvals Arrays.asList(25,36,49,64,81,100,121,144,169,196,255);
List origValues sqVals.stream().map(i ->(int)(Math.sqrt(i))).collect (Collectors.toList());
Map mapSquare new HashMap<>();
mapSquare IntStream.range(0, origValues.size()).boxed().filter(x->(x2!=0)).collect (Collectors.toMap(origValues::get, sqVals::get));
mapSquare.forEach((key, value)-> System.out.printf("%3d 3d
", key, value));
What will be the output of the above code?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!