package kotlin.ranges; import java.util.NoSuchElementException; import kotlin.collections.LongIterator; /* loaded from: classes5.dex */ public final class LongProgressionIterator extends LongIterator { public final long finalElement; public boolean hasNext; public long next; public final long step; @Override // java.util.Iterator public boolean hasNext() { return this.hasNext; } public LongProgressionIterator(long j, long j2, long j3) { this.step = j3; this.finalElement = j2; boolean z = true; if (j3 <= 0 ? j < j2 : j > j2) { z = false; } this.hasNext = z; this.next = z ? j : j2; } @Override // kotlin.collections.LongIterator public long nextLong() { long j = this.next; if (j != this.finalElement) { this.next = this.step + j; } else { if (!this.hasNext) { throw new NoSuchElementException(); } this.hasNext = false; } return j; } }