alexandroid/decompiled/jadx/sources/dagger/internal/SetBuilder.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

42 lines
1.4 KiB
Java

package dagger.internal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
/* loaded from: classes9.dex */
public final class SetBuilder<T> {
private static final String SET_CONTRIBUTIONS_CANNOT_BE_NULL = "Set contributions cannot be null";
private final List<T> contributions;
private SetBuilder(int i) {
this.contributions = new ArrayList(i);
}
public static <T> SetBuilder<T> newSetBuilder(int i) {
return new SetBuilder<>(i);
}
public SetBuilder<T> add(T t) {
this.contributions.add(Preconditions.checkNotNull(t, SET_CONTRIBUTIONS_CANNOT_BE_NULL));
return this;
}
public SetBuilder<T> addAll(Collection<? extends T> collection) {
Iterator<? extends T> it2 = collection.iterator();
while (it2.hasNext()) {
Preconditions.checkNotNull(it2.next(), SET_CONTRIBUTIONS_CANNOT_BE_NULL);
}
this.contributions.addAll(collection);
return this;
}
public Set<T> build() {
return this.contributions.isEmpty() ? Collections.EMPTY_SET : this.contributions.size() == 1 ? Collections.singleton(this.contributions.get(0)) : Collections.unmodifiableSet(new HashSet(this.contributions));
}
}