package okhttp3; import java.io.IOException; import java.util.Iterator; import java.util.NoSuchElementException; import o.C14957gcv; import o.C15160gio; import o.InterfaceC14931gcN; import o.gbF; import okhttp3.internal.cache.DiskLruCache; /* loaded from: classes.dex */ public final class Cache$urls$1 implements Iterator, InterfaceC14931gcN { private boolean canRemove; private final Iterator delegate; private String nextUrl; final Cache this$0; /* JADX INFO: Access modifiers changed from: package-private */ public Cache$urls$1(Cache cache) { this.this$0 = cache; this.delegate = cache.getCache$okhttp().snapshots(); } @Override // java.util.Iterator public final boolean hasNext() { if (this.nextUrl != null) { return true; } this.canRemove = false; while (this.delegate.hasNext()) { try { DiskLruCache.Snapshot next = this.delegate.next(); try { continue; this.nextUrl = C15160gio.c(next.getSource(0)).t(); gbF.d(next, null); return true; } finally { try { continue; break; } catch (Throwable th) { } } } catch (IOException unused) { } } return false; } @Override // java.util.Iterator public final String next() { if (!hasNext()) { throw new NoSuchElementException(); } String str = this.nextUrl; C14957gcv.e(str); this.nextUrl = null; this.canRemove = true; return str; } @Override // java.util.Iterator public final void remove() { if (!this.canRemove) { throw new IllegalStateException("remove() before next()".toString()); } this.delegate.remove(); } }