Question: Rewrite this lambda that takes an int n using a constructor reference: n -> new ArrayList (n). A. ArrayList::new B. ArrayList::new() C. ArrayList::new(n) D. ArrayList::new[n]

Rewrite this lambda that takes an int n using a constructor reference: n -> new ArrayList<>(n).

A. ArrayList::new

B. ArrayList::new()

C. ArrayList::new(n)

D. ArrayList::new[n]

E. None of the above.

Step by Step Solution

3.41 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The correct answer is A ArrayListnew In Java 8 lambda expressions can be replace... View full answer

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 Oracle Questions!