JAVA need help with public Iterator iterator() import java.util.Iterator; /* * GroupsQueue class supporting addition and removal of items * with respect to a given number of priorities and with * respect to the FIFO (first-in first-out) order for items * with the same priority. * * An example, where GroupsQueue would be useful is the airline * boarding process: every passenger gets assigned a priority, * usually a number, e.g., group 1, group 2, group 3, etc. and * the passengers line up at the end of the queue of their groups * in a FIFO fashion; and, when removing from the GroupsQueue, * i.e., when the passengers are boarding the plane, they get * removed first by their group priorities and then by their FIFO * ordering within that particular priority group. * * Your homework is to implement the below GroupsQueue data * structure, so that it functions in the way described above. * * You may use the provided Queue class for implementing the * GroupsQueue class. */ public class GroupsQueue implements Iterable { private Node first; private Node last; private int n; private static class Node { private Item item; private Node next; } public void Queue() { first = null; last = null; n = 0; } // TODO : implement the data structure (20 points) /** * Initializes an empty GroupsQueue with g groups * @return */ public GroupsQueue(int g) { first = new Node<>(); last = first; for(int i=1; i<=19; i++){ last.next = new Node<>(); last = last.next; } } // TODO : implement the constructor (20 points) /** * Is this GroupsQueue empty? */ public boolean isEmpty() { return size() == 0; } /** * Returns the number of items in the GroupsQueue. */ public int size() { return n; // TODO (20 points) } /** * Adds the item to this GroupsQueue with group id = gId. */ public void add(Item item, int gId) { Node oldlast = last; last = new Node(); last.item = item; last.next = null; if (isEmpty()) first = last; else{ oldlast.next = last; } n++; } // TODO (20 points) /** * Removes and returns the item with the lowest group id */ public Item remove() { Node temp = first; Node prev = first; Item minGid; if (! isEmpty()) { minGid = first.item; } else { return null; } while(temp!= null) { prev = temp; temp = temp.next; if (temp.item == minGid) { minGid = (Item) temp.item; } } if (minGid == first.item) { first = first.next; } else { prev.next = prev.next.next; } n--; return minGid; }// TODO (20 points) /** * Returns an iterator that iterates over the items in this GroupsQueue * in group id order (lowest id first) and in FIFO order in each group. */ public Iterator iterator() { // TODO // BONUS (20 points) return null; } } Solution Implementation given here seems to have many logical errors. Here is the code given for GroupQueue: package groupqueue; public class GroupQueue{ /** * n is number of queues maintained. and queues is array of all queues maintained by GroupQueue. * here there are n groups . so maintain n queues and each queue represent one group. */ public int n; public Que.