package kotlin.jvm.optionals; import androidx.exifinterface.media.ExifInterface; import java.util.Collection; import java.util.List; import java.util.Optional; import java.util.Set; import kotlin.Metadata; import kotlin.collections.CollectionsKt; import kotlin.collections.SetsKt; import kotlin.jvm.functions.Function0; import kotlin.jvm.internal.Intrinsics; import kotlin.sequences.Sequence; import kotlin.sequences.SequencesKt; /* compiled from: Optionals.kt */ @Metadata(d1 = {"\u00000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u001f\n\u0002\b\u0003\n\u0002\u0010 \n\u0000\n\u0002\u0010\"\n\u0000\u001a$\u0010\u0000\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0001\"\b\b\u0000\u0010\u0002*\u00020\u0003*\n\u0012\u0006\b\u0001\u0012\u0002H\u00020\u0004H\u0007\u001a,\u0010\u0005\u001a\u0002H\u0002\"\u0004\b\u0000\u0010\u0002*\f\u0012\b\b\u0001\u0012\u0004\b\u0002H\u00020\u00042\u0006\u0010\u0006\u001a\u0002H\u0002H\u0007ø\u0001\u0000¢\u0006\u0002\u0010\u0007\u001a6\u0010\b\u001a\u0002H\u0002\"\u0004\b\u0000\u0010\u0002*\f\u0012\b\b\u0001\u0012\u0004\b\u0002H\u00020\u00042\f\u0010\u0006\u001a\b\u0012\u0004\u0012\u0002H\u00020\tH\u0087\bø\u0001\u0001ø\u0001\u0000¢\u0006\u0002\u0010\n\u001a#\u0010\u000b\u001a\u0004\u0018\u0001H\u0002\"\b\b\u0000\u0010\u0002*\u00020\u0003*\b\u0012\u0004\u0012\u0002H\u00020\u0004H\u0007¢\u0006\u0002\u0010\f\u001a;\u0010\r\u001a\u0002H\u000e\"\b\b\u0000\u0010\u0002*\u00020\u0003\"\u0010\b\u0001\u0010\u000e*\n\u0012\u0006\b\u0000\u0012\u0002H\u00020\u000f*\b\u0012\u0004\u0012\u0002H\u00020\u00042\u0006\u0010\u0010\u001a\u0002H\u000eH\u0007¢\u0006\u0002\u0010\u0011\u001a$\u0010\u0012\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0013\"\b\b\u0000\u0010\u0002*\u00020\u0003*\n\u0012\u0006\b\u0001\u0012\u0002H\u00020\u0004H\u0007\u001a$\u0010\u0014\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0015\"\b\b\u0000\u0010\u0002*\u00020\u0003*\n\u0012\u0006\b\u0001\u0012\u0002H\u00020\u0004H\u0007\u0082\u0002\u000b\n\u0002\b9\n\u0005\b\u009920\u0001¨\u0006\u0016"}, d2 = {"asSequence", "Lkotlin/sequences/Sequence;", ExifInterface.GPS_DIRECTION_TRUE, "", "Ljava/util/Optional;", "getOrDefault", "defaultValue", "(Ljava/util/Optional;Ljava/lang/Object;)Ljava/lang/Object;", "getOrElse", "Lkotlin/Function0;", "(Ljava/util/Optional;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;", "getOrNull", "(Ljava/util/Optional;)Ljava/lang/Object;", "toCollection", "C", "", "destination", "(Ljava/util/Optional;Ljava/util/Collection;)Ljava/util/Collection;", "toList", "", "toSet", "", "kotlin-stdlib-jdk8"}, k = 2, mv = {1, 9, 0}, xi = 48) /* loaded from: classes3.dex */ public final class OptionalsKt { public static final T getOrNull(Optional optional) { Intrinsics.checkNotNullParameter(optional, ""); return optional.orElse(null); } public static final T getOrDefault(Optional optional, T t) { Intrinsics.checkNotNullParameter(optional, ""); return optional.isPresent() ? optional.get() : t; } public static final T getOrElse(Optional optional, Function0 defaultValue) { Intrinsics.checkNotNullParameter(optional, ""); Intrinsics.checkNotNullParameter(defaultValue, "defaultValue"); return optional.isPresent() ? optional.get() : defaultValue.invoke(); } public static final > C toCollection(Optional optional, C destination) { Intrinsics.checkNotNullParameter(optional, ""); Intrinsics.checkNotNullParameter(destination, "destination"); if (optional.isPresent()) { T t = optional.get(); Intrinsics.checkNotNullExpressionValue(t, "get(...)"); destination.add(t); } return destination; } public static final List toList(Optional optional) { Intrinsics.checkNotNullParameter(optional, ""); return optional.isPresent() ? CollectionsKt.listOf(optional.get()) : CollectionsKt.emptyList(); } public static final Set toSet(Optional optional) { Intrinsics.checkNotNullParameter(optional, ""); return optional.isPresent() ? SetsKt.setOf(optional.get()) : SetsKt.emptySet(); } public static final Sequence asSequence(Optional optional) { Intrinsics.checkNotNullParameter(optional, ""); return optional.isPresent() ? SequencesKt.sequenceOf(optional.get()) : SequencesKt.emptySequence(); } }