Page 1 of 1

PLEASE HELP - IN JAVA Given the following code: ArrayList items = new ArrayList<>(); Write a for each using lamb

Posted: Sat May 14, 2022 3:38 pm
by answerhappygod
PLEASE HELP - IN JAVA
Given the following code:
ArrayList<String> items = new
ArrayList<>();
Write a for each using lambda expression to print all the
elements of the ArrayList. (2 pts)
interface
Calc{
double calculate(ArrayList<String>
items);
}
Sample input and output:
Input:
ArrayList<String> items = new
ArrayList<String>();
items.add("Bob");
items.add("Samantha");
items.add("Emily");
items.add("Jack");
items.add("Lina");
Output:
4.8