package com.google.common.collect;

import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;

/* loaded from: classes3.dex */
public abstract class w {

    /* loaded from: classes3.dex */
    class a extends r0 {

        /* renamed from: p, reason: collision with root package name */
        boolean f14313p;

        /* renamed from: q, reason: collision with root package name */
        final /* synthetic */ Object f14314q;

        a(Object obj) {
            this.f14314q = obj;
        }

        @Override // java.util.Iterator
        public boolean hasNext() {
            return !this.f14313p;
        }

        @Override // java.util.Iterator
        public Object next() {
            if (this.f14313p) {
                throw new NoSuchElementException();
            }
            this.f14313p = true;
            return this.f14314q;
        }
    }

    public static boolean a(Collection collection, Iterator it) {
        ck.j.i(collection);
        ck.j.i(it);
        boolean z10 = false;
        while (it.hasNext()) {
            z10 |= collection.add(it.next());
        }
        return z10;
    }

    public static boolean b(Iterator it, Iterator it2) {
        while (it.hasNext()) {
            if (!it2.hasNext() || !ck.f.a(it.next(), it2.next())) {
                return false;
            }
        }
        return !it2.hasNext();
    }

    public static r0 c(Object obj) {
        return new a(obj);
    }
}
