what-the-bank/sources/com/google/common/collect/ConsumingQueueIterator.java

28 lines
842 B
Java

package com.google.common.collect;
import com.google.common.base.Preconditions;
import java.util.ArrayDeque;
import java.util.Collections;
import java.util.Queue;
/* loaded from: classes2.dex */
class ConsumingQueueIterator<T> extends AbstractIterator<T> {
private final Queue<T> queue;
ConsumingQueueIterator(T... tArr) {
ArrayDeque arrayDeque = new ArrayDeque(tArr.length);
this.queue = arrayDeque;
Collections.addAll(arrayDeque, tArr);
}
/* JADX INFO: Access modifiers changed from: package-private */
public ConsumingQueueIterator(Queue<T> queue) {
this.queue = (Queue) Preconditions.checkNotNull(queue);
}
@Override // com.google.common.collect.AbstractIterator
public T computeNext() {
return this.queue.isEmpty() ? endOfData() : this.queue.remove();
}
}