72 lines
2.0 KiB
Java
72 lines
2.0 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.base.Preconditions;
|
|
|
|
/* loaded from: classes.dex */
|
|
final class SingletonImmutableSet<E> extends ImmutableSet<E> {
|
|
final transient E a;
|
|
private transient int b;
|
|
|
|
SingletonImmutableSet(E e) {
|
|
Preconditions.a(e);
|
|
this.a = e;
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public boolean contains(Object obj) {
|
|
return this.a.equals(obj);
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableCollection
|
|
int copyIntoArray(Object[] objArr, int i) {
|
|
objArr[i] = this.a;
|
|
return i + 1;
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableSet
|
|
ImmutableList<E> createAsList() {
|
|
return ImmutableList.of((Object) this.a);
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableSet, java.util.Collection, java.util.Set
|
|
public final int hashCode() {
|
|
int i = this.b;
|
|
if (i != 0) {
|
|
return i;
|
|
}
|
|
int hashCode = this.a.hashCode();
|
|
this.b = hashCode;
|
|
return hashCode;
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableSet
|
|
boolean isHashCodeFast() {
|
|
return this.b != 0;
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableCollection
|
|
boolean isPartialView() {
|
|
return false;
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public int size() {
|
|
return 1;
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection
|
|
public String toString() {
|
|
return '[' + this.a.toString() + ']';
|
|
}
|
|
|
|
@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
|
|
public UnmodifiableIterator<E> iterator() {
|
|
return Iterators.a(this.a);
|
|
}
|
|
|
|
SingletonImmutableSet(E e, int i) {
|
|
this.a = e;
|
|
this.b = i;
|
|
}
|
|
}
|