ADD week 5
This commit is contained in:
113
02-Easy5/E5/sources/kotlin/collections/ArrayAsCollection.java
Normal file
113
02-Easy5/E5/sources/kotlin/collections/ArrayAsCollection.java
Normal file
@ -0,0 +1,113 @@
|
||||
package kotlin.collections;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.ArrayIteratorKt;
|
||||
import kotlin.jvm.internal.CollectionToArray;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
import kotlin.jvm.internal.markers.KMappedMarker;
|
||||
|
||||
/* compiled from: Collections.kt */
|
||||
@Metadata(d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u001e\n\u0000\n\u0002\u0010\u0011\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\f\n\u0002\u0010(\n\u0000\n\u0002\u0010\u0000\n\u0000\b\u0002\u0018\u0000*\u0004\b\u0000\u0010\u00012\b\u0012\u0004\u0012\u0002H\u00010\u0002B\u001d\u0012\u000e\u0010\u0003\u001a\n\u0012\u0006\b\u0001\u0012\u00028\u00000\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007J\u0016\u0010\u0010\u001a\u00020\u00062\u0006\u0010\u0011\u001a\u00028\u0000H\u0096\u0002¢\u0006\u0002\u0010\u0012J\u0016\u0010\u0013\u001a\u00020\u00062\f\u0010\u0014\u001a\b\u0012\u0004\u0012\u00028\u00000\u0002H\u0016J\b\u0010\u0015\u001a\u00020\u0006H\u0016J\u000f\u0010\u0016\u001a\b\u0012\u0004\u0012\u00028\u00000\u0017H\u0096\u0002J\u0015\u0010\u0018\u001a\f\u0012\b\b\u0001\u0012\u0004\u0018\u00010\u00190\u0004¢\u0006\u0002\u0010\u000eR\u0011\u0010\u0005\u001a\u00020\u0006¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\bR\u0014\u0010\t\u001a\u00020\n8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u000b\u0010\fR\u001b\u0010\u0003\u001a\n\u0012\u0006\b\u0001\u0012\u00028\u00000\u0004¢\u0006\n\n\u0002\u0010\u000f\u001a\u0004\b\r\u0010\u000e¨\u0006\u001a"}, d2 = {"Lkotlin/collections/ArrayAsCollection;", "T", "", "values", "", "isVarargs", "", "([Ljava/lang/Object;Z)V", "()Z", "size", "", "getSize", "()I", "getValues", "()[Ljava/lang/Object;", "[Ljava/lang/Object;", "contains", "element", "(Ljava/lang/Object;)Z", "containsAll", "elements", "isEmpty", "iterator", "", "toArray", "", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
final class ArrayAsCollection<T> implements Collection<T>, KMappedMarker {
|
||||
private final boolean isVarargs;
|
||||
private final T[] values;
|
||||
|
||||
@Override // java.util.Collection
|
||||
public boolean add(T t) {
|
||||
throw new UnsupportedOperationException("Operation is not supported for read-only collection");
|
||||
}
|
||||
|
||||
@Override // java.util.Collection
|
||||
public boolean addAll(Collection<? extends T> collection) {
|
||||
throw new UnsupportedOperationException("Operation is not supported for read-only collection");
|
||||
}
|
||||
|
||||
@Override // java.util.Collection
|
||||
public void clear() {
|
||||
throw new UnsupportedOperationException("Operation is not supported for read-only collection");
|
||||
}
|
||||
|
||||
public final T[] getValues() {
|
||||
return this.values;
|
||||
}
|
||||
|
||||
/* renamed from: isVarargs, reason: from getter */
|
||||
public final boolean getIsVarargs() {
|
||||
return this.isVarargs;
|
||||
}
|
||||
|
||||
@Override // java.util.Collection
|
||||
public boolean remove(Object obj) {
|
||||
throw new UnsupportedOperationException("Operation is not supported for read-only collection");
|
||||
}
|
||||
|
||||
@Override // java.util.Collection
|
||||
public boolean removeAll(Collection<? extends Object> collection) {
|
||||
throw new UnsupportedOperationException("Operation is not supported for read-only collection");
|
||||
}
|
||||
|
||||
@Override // java.util.Collection
|
||||
public boolean retainAll(Collection<? extends Object> collection) {
|
||||
throw new UnsupportedOperationException("Operation is not supported for read-only collection");
|
||||
}
|
||||
|
||||
@Override // java.util.Collection
|
||||
public <T> T[] toArray(T[] array) {
|
||||
Intrinsics.checkNotNullParameter(array, "array");
|
||||
return (T[]) CollectionToArray.toArray(this, array);
|
||||
}
|
||||
|
||||
public ArrayAsCollection(T[] values, boolean z) {
|
||||
Intrinsics.checkNotNullParameter(values, "values");
|
||||
this.values = values;
|
||||
this.isVarargs = z;
|
||||
}
|
||||
|
||||
@Override // java.util.Collection
|
||||
public final /* bridge */ int size() {
|
||||
return getSize();
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return this.values.length;
|
||||
}
|
||||
|
||||
@Override // java.util.Collection
|
||||
public boolean isEmpty() {
|
||||
return this.values.length == 0;
|
||||
}
|
||||
|
||||
@Override // java.util.Collection
|
||||
public boolean contains(Object element) {
|
||||
return ArraysKt.contains(this.values, element);
|
||||
}
|
||||
|
||||
@Override // java.util.Collection
|
||||
public boolean containsAll(Collection<? extends Object> elements) {
|
||||
Intrinsics.checkNotNullParameter(elements, "elements");
|
||||
Collection<? extends Object> collection = elements;
|
||||
if (collection.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
Iterator<T> it = collection.iterator();
|
||||
while (it.hasNext()) {
|
||||
if (!contains(it.next())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // java.util.Collection, java.lang.Iterable
|
||||
public Iterator<T> iterator() {
|
||||
return ArrayIteratorKt.iterator(this.values);
|
||||
}
|
||||
|
||||
@Override // java.util.Collection
|
||||
public final Object[] toArray() {
|
||||
return CollectionsKt.copyToArrayOfAny(this.values, this.isVarargs);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user