我想做这样的事情:
int[][] A = ... // initialize matrix
List<Integer> rows = new LinkedList<Integer>();
for (int r = 0; r < 1000000; r++) rows.add(r);
Iterator<Integer> iter = rows.iterator();
for ( ; iter.hasNext(); ) {
// some condition based on which I remove an element
if (200 != A[iter.next().intValue()][0]) iter.remove();
}
if (rows.isEmpty()) {
System.out.println("empty");
}
但它不起作用。