what-the-bank/sources/com/google/common/collect/RegularImmutableSet.java

106 lines
3.9 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.common.collect;
import java.util.Iterator;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public final class RegularImmutableSet<E> extends ImmutableSet<E> {
static final RegularImmutableSet<Object> EMPTY = new RegularImmutableSet<>(new Object[0], 0, null, 0, 0);
final transient Object[] elements;
private final transient int hashCode;
private final transient int mask;
private final transient int size;
final transient Object[] table;
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableCollection
public final int internalArrayStart() {
return 0;
}
@Override // com.google.common.collect.ImmutableSet
final boolean isHashCodeFast() {
return true;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableCollection
public final boolean isPartialView() {
return false;
}
@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 final /* bridge */ /* synthetic */ Iterator iterator() {
return iterator();
}
/* JADX INFO: Access modifiers changed from: package-private */
public RegularImmutableSet(Object[] objArr, int i, Object[] objArr2, int i2, int i3) {
this.elements = objArr;
this.table = objArr2;
this.mask = i2;
this.hashCode = i;
this.size = i3;
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public final boolean contains(Object obj) {
Object[] objArr = this.table;
if (obj == null || objArr == null) {
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 final UnmodifiableIterator<E> iterator() {
return asList().iterator();
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableCollection
public final 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 final ImmutableList<E> createAsList() {
return ImmutableList.asImmutableList(this.elements, this.size);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public final int size() {
return this.size;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableCollection
public final int internalArrayEnd() {
return this.size;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableCollection
public final Object[] internalArray() {
return this.elements;
}
@Override // com.google.common.collect.ImmutableSet, java.util.Collection, java.util.Set
public final int hashCode() {
return this.hashCode;
}
}