ADD week 5
This commit is contained in:
@ -0,0 +1,85 @@
|
||||
package kotlin.streams.jdk8;
|
||||
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.FileSystemException;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.nio.file.SecureDirectoryStream;
|
||||
import java.nio.file.attribute.BasicFileAttributeView;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.nio.file.attribute.FileAttributeView;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionException;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
/* compiled from: D8$$SyntheticClass */
|
||||
/* loaded from: classes.dex */
|
||||
public final /* synthetic */ class StreamsKt$$ExternalSyntheticApiModelOutline0 {
|
||||
public static /* bridge */ /* synthetic */ Class m() {
|
||||
return BasicFileAttributeView.class;
|
||||
}
|
||||
|
||||
public static /* bridge */ /* synthetic */ DirectoryStream m(Object obj) {
|
||||
return (DirectoryStream) obj;
|
||||
}
|
||||
|
||||
public static /* synthetic */ FileSystemException m(String str, String str2, String str3) {
|
||||
return new FileSystemException(str, str2, str3);
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* synthetic */ NoSuchFileException m1620m(String str, String str2, String str3) {
|
||||
return new NoSuchFileException(str, str2, str3);
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* bridge */ /* synthetic */ SecureDirectoryStream m1623m(Object obj) {
|
||||
return (SecureDirectoryStream) obj;
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* bridge */ /* synthetic */ BasicFileAttributeView m1625m(Object obj) {
|
||||
return (BasicFileAttributeView) obj;
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* bridge */ /* synthetic */ BasicFileAttributes m1626m(Object obj) {
|
||||
return (BasicFileAttributes) obj;
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* bridge */ /* synthetic */ FileAttributeView m1627m(Object obj) {
|
||||
return (FileAttributeView) obj;
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* synthetic */ CompletableFuture m1634m() {
|
||||
return new CompletableFuture();
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* bridge */ /* synthetic */ CompletionException m1635m(Object obj) {
|
||||
return (CompletionException) obj;
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* bridge */ /* synthetic */ BiFunction m1636m(Object obj) {
|
||||
return (BiFunction) obj;
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* synthetic */ void m1638m() {
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* bridge */ /* synthetic */ boolean m1641m(Object obj) {
|
||||
return obj instanceof SecureDirectoryStream;
|
||||
}
|
||||
|
||||
public static /* bridge */ /* synthetic */ Class m$1() {
|
||||
return FileAttributeView.class;
|
||||
}
|
||||
|
||||
public static /* bridge */ /* synthetic */ boolean m$1(Object obj) {
|
||||
return obj instanceof CompletionException;
|
||||
}
|
||||
}
|
133
02-Easy5/E5/sources/kotlin/streams/jdk8/StreamsKt.java
Normal file
133
02-Easy5/E5/sources/kotlin/streams/jdk8/StreamsKt.java
Normal file
@ -0,0 +1,133 @@
|
||||
package kotlin.streams.jdk8;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.PrimitiveIterator;
|
||||
import java.util.Spliterator;
|
||||
import java.util.Spliterators;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.DoubleStream;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.LongStream;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.collections.ArraysKt;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
import kotlin.sequences.Sequence;
|
||||
|
||||
/* compiled from: Streams.kt */
|
||||
@Metadata(d1 = {"\u0000.\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0006\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0002\u0018\u0002\n\u0002\u0010\t\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0000\u001a\u0012\u0010\u0000\u001a\b\u0012\u0004\u0012\u00020\u00020\u0001*\u00020\u0003H\u0007\u001a\u0012\u0010\u0000\u001a\b\u0012\u0004\u0012\u00020\u00040\u0001*\u00020\u0005H\u0007\u001a\u0012\u0010\u0000\u001a\b\u0012\u0004\u0012\u00020\u00060\u0001*\u00020\u0007H\u0007\u001a\u001e\u0010\u0000\u001a\b\u0012\u0004\u0012\u0002H\b0\u0001\"\u0004\b\u0000\u0010\b*\b\u0012\u0004\u0012\u0002H\b0\tH\u0007\u001a\u001e\u0010\n\u001a\b\u0012\u0004\u0012\u0002H\b0\t\"\u0004\b\u0000\u0010\b*\b\u0012\u0004\u0012\u0002H\b0\u0001H\u0007\u001a\u0012\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\u00020\f*\u00020\u0003H\u0007\u001a\u0012\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\u00040\f*\u00020\u0005H\u0007\u001a\u0012\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\u00060\f*\u00020\u0007H\u0007\u001a\u001e\u0010\u000b\u001a\b\u0012\u0004\u0012\u0002H\b0\f\"\u0004\b\u0000\u0010\b*\b\u0012\u0004\u0012\u0002H\b0\tH\u0007¨\u0006\r"}, d2 = {"asSequence", "Lkotlin/sequences/Sequence;", "", "Ljava/util/stream/DoubleStream;", "", "Ljava/util/stream/IntStream;", "", "Ljava/util/stream/LongStream;", "T", "Ljava/util/stream/Stream;", "asStream", "toList", "", "kotlin-stdlib-jdk8"}, k = 2, mv = {1, 8, 0}, pn = "kotlin.streams", xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class StreamsKt {
|
||||
public static final <T> Sequence<T> asSequence(final Stream<T> stream) {
|
||||
Intrinsics.checkNotNullParameter(stream, "<this>");
|
||||
return new Sequence<T>() { // from class: kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$1
|
||||
@Override // kotlin.sequences.Sequence
|
||||
public Iterator<T> iterator() {
|
||||
Iterator<T> it;
|
||||
it = stream.iterator();
|
||||
Intrinsics.checkNotNullExpressionValue(it, "iterator()");
|
||||
return it;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static final Sequence<Integer> asSequence(final IntStream intStream) {
|
||||
Intrinsics.checkNotNullParameter(intStream, "<this>");
|
||||
return new Sequence<Integer>() { // from class: kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$2
|
||||
@Override // kotlin.sequences.Sequence
|
||||
public Iterator<Integer> iterator() {
|
||||
PrimitiveIterator.OfInt it;
|
||||
it = intStream.iterator();
|
||||
Intrinsics.checkNotNullExpressionValue(it, "iterator()");
|
||||
return it;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static final Sequence<Long> asSequence(final LongStream longStream) {
|
||||
Intrinsics.checkNotNullParameter(longStream, "<this>");
|
||||
return new Sequence<Long>() { // from class: kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$3
|
||||
@Override // kotlin.sequences.Sequence
|
||||
public Iterator<Long> iterator() {
|
||||
PrimitiveIterator.OfLong it;
|
||||
it = longStream.iterator();
|
||||
Intrinsics.checkNotNullExpressionValue(it, "iterator()");
|
||||
return it;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static final Sequence<Double> asSequence(final DoubleStream doubleStream) {
|
||||
Intrinsics.checkNotNullParameter(doubleStream, "<this>");
|
||||
return new Sequence<Double>() { // from class: kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$4
|
||||
@Override // kotlin.sequences.Sequence
|
||||
public Iterator<Double> iterator() {
|
||||
PrimitiveIterator.OfDouble it;
|
||||
it = doubleStream.iterator();
|
||||
Intrinsics.checkNotNullExpressionValue(it, "iterator()");
|
||||
return it;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static final <T> Stream<T> asStream(final Sequence<? extends T> sequence) {
|
||||
Stream<T> stream;
|
||||
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||||
stream = StreamSupport.stream(new Supplier() { // from class: kotlin.streams.jdk8.StreamsKt$$ExternalSyntheticLambda7
|
||||
@Override // java.util.function.Supplier
|
||||
public final Object get() {
|
||||
Spliterator asStream$lambda$4;
|
||||
asStream$lambda$4 = StreamsKt.asStream$lambda$4(Sequence.this);
|
||||
return asStream$lambda$4;
|
||||
}
|
||||
}, 16, false);
|
||||
Intrinsics.checkNotNullExpressionValue(stream, "stream({ Spliterators.sp…literator.ORDERED, false)");
|
||||
return stream;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static final Spliterator asStream$lambda$4(Sequence this_asStream) {
|
||||
Spliterator spliteratorUnknownSize;
|
||||
Intrinsics.checkNotNullParameter(this_asStream, "$this_asStream");
|
||||
spliteratorUnknownSize = Spliterators.spliteratorUnknownSize(this_asStream.iterator(), 16);
|
||||
return spliteratorUnknownSize;
|
||||
}
|
||||
|
||||
public static final <T> List<T> toList(Stream<T> stream) {
|
||||
Collector list;
|
||||
Object collect;
|
||||
Intrinsics.checkNotNullParameter(stream, "<this>");
|
||||
list = Collectors.toList();
|
||||
collect = stream.collect(list);
|
||||
Intrinsics.checkNotNullExpressionValue(collect, "collect(Collectors.toList<T>())");
|
||||
return (List) collect;
|
||||
}
|
||||
|
||||
public static final List<Integer> toList(IntStream intStream) {
|
||||
int[] array;
|
||||
Intrinsics.checkNotNullParameter(intStream, "<this>");
|
||||
array = intStream.toArray();
|
||||
Intrinsics.checkNotNullExpressionValue(array, "toArray()");
|
||||
return ArraysKt.asList(array);
|
||||
}
|
||||
|
||||
public static final List<Long> toList(LongStream longStream) {
|
||||
long[] array;
|
||||
Intrinsics.checkNotNullParameter(longStream, "<this>");
|
||||
array = longStream.toArray();
|
||||
Intrinsics.checkNotNullExpressionValue(array, "toArray()");
|
||||
return ArraysKt.asList(array);
|
||||
}
|
||||
|
||||
public static final List<Double> toList(DoubleStream doubleStream) {
|
||||
double[] array;
|
||||
Intrinsics.checkNotNullParameter(doubleStream, "<this>");
|
||||
array = doubleStream.toArray();
|
||||
Intrinsics.checkNotNullExpressionValue(array, "toArray()");
|
||||
return ArraysKt.asList(array);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user