Rabbit-R1/android (non root)/java/sources/com/google/common/collect/RegularImmutableSet.java
2024-05-21 17:08:36 -04:00

108 lines
3.7 KiB
Java

package com.google.common.collect;
import javax.annotation.CheckForNull;
/* JADX INFO: Access modifiers changed from: package-private */
@ElementTypesAreNonnullByDefault
/* loaded from: classes3.dex */
public final class RegularImmutableSet<E> extends ImmutableSet<E> {
static final RegularImmutableSet<Object> EMPTY;
private static final Object[] EMPTY_ARRAY;
final transient Object[] elements;
private final transient int hashCode;
private final transient int mask;
private final transient int size;
final transient Object[] table;
@Override // com.google.common.collect.ImmutableSet, java.util.Collection, java.util.Set
public int hashCode() {
return this.hashCode;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableCollection
public Object[] internalArray() {
return this.elements;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableCollection
public int internalArrayEnd() {
return this.size;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableCollection
public int internalArrayStart() {
return 0;
}
@Override // com.google.common.collect.ImmutableSet
boolean isHashCodeFast() {
return true;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableCollection
public boolean isPartialView() {
return false;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return this.size;
}
static {
Object[] objArr = new Object[0];
EMPTY_ARRAY = objArr;
EMPTY = new RegularImmutableSet<>(objArr, 0, objArr, 0, 0);
}
/* JADX INFO: Access modifiers changed from: package-private */
public RegularImmutableSet(Object[] objArr, int i, Object[] objArr2, int i2, int i3) {
this.elements = objArr;
this.hashCode = i;
this.table = objArr2;
this.mask = i2;
this.size = i3;
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(@CheckForNull Object obj) {
Object[] objArr = this.table;
if (obj == null || objArr.length == 0) {
return false;
}
int smearedHash = Hashing.smearedHash(obj);
while (true) {
int i = smearedHash & this.mask;
Object obj2 = objArr[i];
if (obj2 == null) {
return false;
}
if (obj2.equals(obj)) {
return true;
}
smearedHash = i + 1;
}
}
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet, com.google.common.collect.SortedIterable
public UnmodifiableIterator<E> iterator() {
return asList().iterator();
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableCollection
public int copyIntoArray(Object[] objArr, int i) {
System.arraycopy(this.elements, 0, objArr, i, this.size);
return i + this.size;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableSet
public ImmutableList<E> createAsList() {
return ImmutableList.asImmutableList(this.elements, this.size);
}
}