package com.google.common.base; import com.google.errorprone.annotations.DoNotMock; import java.io.Serializable; import java.util.Iterator; import java.util.Set; import javax.annotation.CheckForNull; @DoNotMock("Use Optional.of(value) or Optional.absent()") @ElementTypesAreNonnullByDefault /* loaded from: classes2.dex */ public abstract class Optional implements Serializable { private static final long serialVersionUID = 0; public abstract Set asSet(); public abstract boolean equals(@CheckForNull Object obj); public abstract T get(); public abstract int hashCode(); public abstract boolean isPresent(); public abstract Optional or(Optional optional); public abstract T or(Supplier supplier); public abstract T or(T t); @CheckForNull public abstract T orNull(); public abstract String toString(); public abstract Optional transform(Function function); public static Optional absent() { return Absent.withType(); } public static Optional of(T t) { return new Present(Preconditions.checkNotNull(t)); } public static Optional fromNullable(@CheckForNull T t) { return t == null ? absent() : new Present(t); } public static Iterable presentInstances(final Iterable> iterable) { Preconditions.checkNotNull(iterable); return new Iterable() { // from class: com.google.common.base.Optional.1 @Override // java.lang.Iterable public Iterator iterator() { return new AbstractIterator() { // from class: com.google.common.base.Optional.1.1 private final Iterator> iterator; { this.iterator = (Iterator) Preconditions.checkNotNull(iterable.iterator()); } @Override // com.google.common.base.AbstractIterator @CheckForNull protected T computeNext() { while (this.iterator.hasNext()) { Optional next = this.iterator.next(); if (next.isPresent()) { return next.get(); } } return endOfData(); } }; } }; } }