54 lines
1.3 KiB
Java
54 lines
1.3 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.base.Preconditions;
|
|
import java.util.Iterator;
|
|
import java.util.NoSuchElementException;
|
|
|
|
/* loaded from: classes.dex */
|
|
abstract class MultitransformedIterator<F, T> implements Iterator<T> {
|
|
final Iterator<? extends F> a;
|
|
Iterator<? extends T> b = Iterators.a();
|
|
private Iterator<? extends T> c;
|
|
|
|
MultitransformedIterator(Iterator<? extends F> it) {
|
|
Preconditions.a(it);
|
|
this.a = it;
|
|
}
|
|
|
|
abstract Iterator<? extends T> a(F f);
|
|
|
|
@Override // java.util.Iterator
|
|
public boolean hasNext() {
|
|
Preconditions.a(this.b);
|
|
if (this.b.hasNext()) {
|
|
return true;
|
|
}
|
|
while (this.a.hasNext()) {
|
|
Iterator<? extends T> a = a(this.a.next());
|
|
this.b = a;
|
|
Preconditions.a(a);
|
|
if (this.b.hasNext()) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public T next() {
|
|
if (!hasNext()) {
|
|
throw new NoSuchElementException();
|
|
}
|
|
Iterator<? extends T> it = this.b;
|
|
this.c = it;
|
|
return it.next();
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public void remove() {
|
|
CollectPreconditions.a(this.c != null);
|
|
this.c.remove();
|
|
this.c = null;
|
|
}
|
|
}
|