Question: ListHasGreater.java 1 package iteratorlisthasgreater; 3 import java.util.Iterator; 4 import java.util.List; Iterators - list has greater Implement the function public static boolean hasGreater (List numbers, int

 ListHasGreater.java 1 package iteratorlisthasgreater; 3 import java.util.Iterator; 4 import java.util.List; Iterators

ListHasGreater.java 1 package iteratorlisthasgreater; 3 import java.util.Iterator; 4 import java.util.List; Iterators - list has greater Implement the function public static boolean hasGreater (List numbers, int number) in the manner described by the Javadoc. 6 public class ListHasGreater { /** Returns true if the first argument contains a number greater than the * second argument; returns false otherwise. 10 * @param numbers A list of numbers 11 * @param number A number to compare 12 * @return whether first parameter contains a number greater than the 13 * second parameter 14 */ 15 public static boolean hasGreater (List numbers, int number){ for(int i = 0; inumber){ return true; } This exercise is similar to the "Loops" exercise, however you must use an iterator to implement the function. return false; } 23 } You passed 0 out of 4 tests before due date Failures (4): => java.lang. AssertionError: Your solution must use an iterator. => java.lang. AssertionError: Your solution must use an iterator. => java.lang. AssertionError: Your solution must use an iterator. => java.lang. AssertionError: Your solution must use an iterator

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!