I have two lists of type List<Integer[]>: A.Unassigned and A.Shanghai.
I tried the following:
Iterator<Integer[]> UnassignedIt = A.Unassigned.iterator();
A.Shanghai.add(UnassignedIt.next());
UnassignedIt.remove();
but it gives a NoSuchElementException:
java.util.NoSuchElementException at java.util.AbstractList$Itr.next(Unknown Source)
[How can I solve this?]
Check if the iterator has a next item before calling
next():Also, documentation might help a lot. And take the comments into account, the naming conventions, et cetera.