Question: Write a method named frequency that takes as input a list of objects containing a character value and a boolean flag initially set to false,


Write a method named frequency that takes as input a list of objects containing a character value and a boolean flag initially set to false, and prints the frequency of each character of the list. Every time an element is counted, its flag is set to true so that it is not printed or counted a second time. List l new Linkedl List (b,f) (a f) (c,f)-> (b,f)-> (a,f)-> (c ,f)-> (a,f)-> (d,f)-> (d,f)-> (b,f) The method frequency will first display a 4. The list will have been transformed as follows (a,t)-> (b,f) (a ,t) (c,f)-> (b,f)-> (a, t) (c ,f)-> (a, t) (d,f)-> (d,f)-> (b,f) Next, the method displays b 3. The list will have been transformed as follows (a,t)-> (b, t) (a ,t) (c,f)-> (b,t)-> (a, t)-> (c,f)-> (a, t) (d,f)-> (d,f)-> (b,t) Next, the method displays c 2. The list will have been transformed as follows (a,t)-> (b, t) (a ,t) (c,t)-> (b,t)-> (a, t)-> (c, t) (a, t)-> (d,f)-> (d,f)-> (b,t) Finally, the method displays d 2. The list will have been transformed as follows. (a,t)- (b,t)->(a, t) (c,t) (b,t)-> (a,t)->(cit) (a,t)- (dit)-> (d ,t) (b,t) Write a method named frequency that takes as input a list of objects containing a character value and a boolean flag initially set to false, and prints the frequency of each character of the list. Every time an element is counted, its flag is set to true so that it is not printed or counted a second time. List l new Linkedl List (b,f) (a f) (c,f)-> (b,f)-> (a,f)-> (c ,f)-> (a,f)-> (d,f)-> (d,f)-> (b,f) The method frequency will first display a 4. The list will have been transformed as follows (a,t)-> (b,f) (a ,t) (c,f)-> (b,f)-> (a, t) (c ,f)-> (a, t) (d,f)-> (d,f)-> (b,f) Next, the method displays b 3. The list will have been transformed as follows (a,t)-> (b, t) (a ,t) (c,f)-> (b,t)-> (a, t)-> (c,f)-> (a, t) (d,f)-> (d,f)-> (b,t) Next, the method displays c 2. The list will have been transformed as follows (a,t)-> (b, t) (a ,t) (c,t)-> (b,t)-> (a, t)-> (c, t) (a, t)-> (d,f)-> (d,f)-> (b,t) Finally, the method displays d 2. The list will have been transformed as follows. (a,t)- (b,t)->(a, t) (c,t) (b,t)-> (a,t)->(cit) (a,t)- (dit)-> (d ,t) (b,t)