ADD week 5
This commit is contained in:
40
02-Easy5/E5/sources/kotlin/collections/IndexingIterator.java
Normal file
40
02-Easy5/E5/sources/kotlin/collections/IndexingIterator.java
Normal file
@ -0,0 +1,40 @@
|
||||
package kotlin.collections;
|
||||
|
||||
import java.util.Iterator;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
import kotlin.jvm.internal.markers.KMappedMarker;
|
||||
|
||||
/* compiled from: Iterators.kt */
|
||||
@Metadata(d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0010(\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\b\u0000\u0018\u0000*\u0006\b\u0000\u0010\u0001 \u00012\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\u00010\u00030\u0002B\u0013\u0012\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00028\u00000\u0002¢\u0006\u0002\u0010\u0005J\t\u0010\b\u001a\u00020\tH\u0086\u0002J\u000f\u0010\n\u001a\b\u0012\u0004\u0012\u00028\u00000\u0003H\u0086\u0002R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0004\u001a\b\u0012\u0004\u0012\u00028\u00000\u0002X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u000b"}, d2 = {"Lkotlin/collections/IndexingIterator;", "T", "", "Lkotlin/collections/IndexedValue;", "iterator", "(Ljava/util/Iterator;)V", "index", "", "hasNext", "", "next", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class IndexingIterator<T> implements Iterator<IndexedValue<? extends T>>, KMappedMarker {
|
||||
private int index;
|
||||
private final Iterator<T> iterator;
|
||||
|
||||
@Override // java.util.Iterator
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Operation is not supported for read-only collection");
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
public IndexingIterator(Iterator<? extends T> iterator) {
|
||||
Intrinsics.checkNotNullParameter(iterator, "iterator");
|
||||
this.iterator = iterator;
|
||||
}
|
||||
|
||||
@Override // java.util.Iterator
|
||||
public final boolean hasNext() {
|
||||
return this.iterator.hasNext();
|
||||
}
|
||||
|
||||
@Override // java.util.Iterator
|
||||
public final IndexedValue<T> next() {
|
||||
int i = this.index;
|
||||
this.index = i + 1;
|
||||
if (i < 0) {
|
||||
CollectionsKt.throwIndexOverflow();
|
||||
}
|
||||
return new IndexedValue<>(i, this.iterator.next());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user