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

169 lines
5.5 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.google.common.collect;
import com.google.common.collect.Multiset;
import com.google.common.collect.Multisets;
import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public abstract class AbstractMultiset<E> extends AbstractCollection<E> implements Multiset<E> {
private transient Set<E> elementSet;
private transient Set<Multiset.Entry<E>> entrySet;
@Override // java.util.AbstractCollection, java.util.Collection
public abstract void clear();
abstract int distinctElements();
abstract Iterator<E> elementIterator();
/* JADX INFO: Access modifiers changed from: package-private */
public abstract Iterator<Multiset.Entry<E>> entryIterator();
@Override // java.util.AbstractCollection, java.util.Collection
public boolean isEmpty() {
return entrySet().isEmpty();
}
@Override // java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public boolean contains(Object obj) {
return count(obj) > 0;
}
@Override // java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public final boolean add(E e) {
add(e, 1);
return true;
}
public int add(E e, int i) {
throw new UnsupportedOperationException();
}
@Override // java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public final boolean remove(Object obj) {
return remove(obj, 1) > 0;
}
public int remove(Object obj, int i) {
throw new UnsupportedOperationException();
}
public int setCount(E e, int i) {
return Multisets.setCountImpl(this, e, i);
}
public boolean setCount(E e, int i, int i2) {
return Multisets.setCountImpl(this, e, i, i2);
}
@Override // java.util.AbstractCollection, java.util.Collection
public final boolean addAll(Collection<? extends E> collection) {
return Multisets.addAllImpl(this, collection);
}
@Override // java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public final boolean removeAll(Collection<?> collection) {
return Multisets.removeAllImpl(this, collection);
}
@Override // java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public final boolean retainAll(Collection<?> collection) {
return Multisets.retainAllImpl(this, collection);
}
@Override // com.google.common.collect.Multiset
public Set<E> elementSet() {
Set<E> set = this.elementSet;
if (set != null) {
return set;
}
Set<E> createElementSet = createElementSet();
this.elementSet = createElementSet;
return createElementSet;
}
Set<E> createElementSet() {
return new ElementSet(this);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class ElementSet extends Multisets.ElementSet<E> {
final AbstractMultiset this$0;
ElementSet(AbstractMultiset abstractMultiset) {
this.this$0 = abstractMultiset;
}
@Override // com.google.common.collect.Multisets.ElementSet, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<E> iterator() {
return this.this$0.elementIterator();
}
@Override // com.google.common.collect.Multisets.ElementSet
Multiset<E> multiset() {
return this.this$0;
}
}
@Override // com.google.common.collect.Multiset
public Set<Multiset.Entry<E>> entrySet() {
Set<Multiset.Entry<E>> set = this.entrySet;
if (set != null) {
return set;
}
Set<Multiset.Entry<E>> createEntrySet = createEntrySet();
this.entrySet = createEntrySet;
return createEntrySet;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class EntrySet extends Multisets.EntrySet<E> {
final AbstractMultiset this$0;
/* JADX INFO: Access modifiers changed from: package-private */
public EntrySet(AbstractMultiset abstractMultiset) {
this.this$0 = abstractMultiset;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Multiset.Entry<E>> iterator() {
return this.this$0.entryIterator();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return this.this$0.distinctElements();
}
@Override // com.google.common.collect.Multisets.EntrySet
Multiset<E> multiset() {
return this.this$0;
}
}
Set<Multiset.Entry<E>> createEntrySet() {
return new EntrySet(this);
}
@Override // java.util.Collection, com.google.common.collect.Multiset
public final boolean equals(Object obj) {
return Multisets.equalsImpl(this, obj);
}
@Override // java.util.Collection, com.google.common.collect.Multiset
public final int hashCode() {
return entrySet().hashCode();
}
@Override // java.util.AbstractCollection, com.google.common.collect.Multiset
public final String toString() {
return entrySet().toString();
}
}