mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-16 10:57:17 +01:00
85 lines
2.6 KiB
Java
85 lines
2.6 KiB
Java
package com.google.common.base;
|
|
|
|
import androidx.biometric.ErrorUtils$$ExternalSyntheticOutline0;
|
|
import com.amazon.alexa.ra.core.ui.markdown.parser.formatter.MarkdownConstants;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.annotations.J2ktIncompatible;
|
|
import java.util.Collections;
|
|
import java.util.Set;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@GwtCompatible
|
|
/* loaded from: classes8.dex */
|
|
final class Present<T> extends Optional<T> {
|
|
|
|
@J2ktIncompatible
|
|
@GwtIncompatible
|
|
private static final long serialVersionUID = 0;
|
|
private final T reference;
|
|
|
|
public Present(T t) {
|
|
this.reference = t;
|
|
}
|
|
|
|
@Override // com.google.common.base.Optional
|
|
public Set<T> asSet() {
|
|
return Collections.singleton(this.reference);
|
|
}
|
|
|
|
@Override // com.google.common.base.Optional
|
|
public boolean equals(Object obj) {
|
|
if (obj instanceof Present) {
|
|
return this.reference.equals(((Present) obj).reference);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // com.google.common.base.Optional
|
|
public T get() {
|
|
return this.reference;
|
|
}
|
|
|
|
@Override // com.google.common.base.Optional
|
|
public int hashCode() {
|
|
return this.reference.hashCode() + 1502476572;
|
|
}
|
|
|
|
@Override // com.google.common.base.Optional
|
|
public boolean isPresent() {
|
|
return true;
|
|
}
|
|
|
|
@Override // com.google.common.base.Optional
|
|
public T or(T t) {
|
|
Preconditions.checkNotNull(t, "use Optional.orNull() instead of Optional.or(null)");
|
|
return this.reference;
|
|
}
|
|
|
|
@Override // com.google.common.base.Optional
|
|
public T orNull() {
|
|
return this.reference;
|
|
}
|
|
|
|
@Override // com.google.common.base.Optional
|
|
public String toString() {
|
|
return ErrorUtils$$ExternalSyntheticOutline0.m(new StringBuilder("Optional.of("), MarkdownConstants.RIGHT_PARENTHESIS, this.reference);
|
|
}
|
|
|
|
@Override // com.google.common.base.Optional
|
|
public <V> Optional<V> transform(Function<? super T, V> function) {
|
|
return new Present(Preconditions.checkNotNull(function.apply(this.reference), "the Function passed to Optional.transform() must not return null."));
|
|
}
|
|
|
|
@Override // com.google.common.base.Optional
|
|
public Optional<T> or(Optional<? extends T> optional) {
|
|
Preconditions.checkNotNull(optional);
|
|
return this;
|
|
}
|
|
|
|
@Override // com.google.common.base.Optional
|
|
public T or(Supplier<? extends T> supplier) {
|
|
Preconditions.checkNotNull(supplier);
|
|
return this.reference;
|
|
}
|
|
}
|