import java.util.Collections;
import java.util.Iterator;
+import java.util.NoSuchElementException;
import javaewah.EWAHCompressedBitmap;
import javaewah.IntIterator;
final Iterator<StoredBitmap> it = oldPackIndex.getBitmaps().iterator();
return new Iterator<Entry>() {
+ private Entry entry;
+
public boolean hasNext() {
- return it.hasNext();
+ while (entry == null && it.hasNext()) {
+ StoredBitmap sb = it.next();
+ if (newPackIndex.findPosition(sb) != -1)
+ entry = new Entry(sb, sb.getFlags());
+ }
+ return entry != null;
}
public Entry next() {
- StoredBitmap sb = it.next();
- return new Entry(sb, sb.getFlags());
+ if (!hasNext())
+ throw new NoSuchElementException();
+
+ Entry res = entry;
+ entry = null;
+ return res;
}
public void remove() {
if (oldBitmap == null)
return null;
+ if (newPackIndex.findPosition(objectId) == -1)
+ return null;
+
inflated.clear();
for (IntIterator i = oldBitmap.getBitmap().intIterator(); i.hasNext();)
inflated.set(prevToNewMapping[i.next()]);