Question: Consider the following loop for collecting all elements that match a condition; in this case, that the element is larger than 100. ArrayList matches =
Consider the following loop for collecting all elements that match a condition; in this case, that the element is larger than 100.
ArrayList matches = new ArrayList();
for (double element : values)
{
if (element > 100)
{
matches.add(element);
}
}
Trace the flow of the loop, where values contains the elements 110 90 100 120 80. Show two columns, for element and matches.
Step by Step Solution
3.39 Rating (155 Votes )
There are 3 Steps involved in it
element matches 110 110 90 110 100 110 120 110 120 80 110 120 The loop iterates over the elements in ... View full answer
Get step-by-step solutions from verified subject matter experts
