Java question Write a static method that accept a List<T> argument. It should return the number of elements in the lists that are equal to the element that comes before it. Use only iteratods to inspect the list. Do not use for loops or the get () method Java question Write a static method that accept a List<T> argument. It should return the number of elements in the lists that are equal to the element that comes before it. Use only iteratods to inspect the list. Do not use for loops or the get () method Java question
Explanation / Answer
Given are the code for accepting a List argument with static method public static ArrayList (Collection a1 { Iterator itr = a1.iterator(); ArrayList result = new ArrayList(); while (itr.hasNext()) { System.out.println(itr.next()); } }