CrackMe.apk
Download file
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.Multiset;
import com.google.errorprone.annotations.concurrent.LazyInit;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.Objects;
import java.util.Set;
import javax.annotation.CheckForNull;
@ElementTypesAreNonnullByDefault
public abstract class ImmutableMultiset<E> extends ImmutableMultisetGwtSerializationDependencies<E> implements Multiset<E> {
@CheckForNull
@LazyInit
private transient ImmutableList<E> asList;
@CheckForNull
@LazyInit
private transient ImmutableSet<Multiset.Entry<E>> entrySet;
public abstract ImmutableSet<E> elementSet();
/* access modifiers changed from: package-private */
public abstract Multiset.Entry<E> getEntry(int i);
/* access modifiers changed from: package-private */
public abstract Object writeReplace();
public static <E> ImmutableMultiset<E> of() {
return RegularImmutableMultiset.EMPTY;
}
public static <E> ImmutableMultiset<E> of(E e) {
return copyFromElements(e);
}
public static <E> ImmutableMultiset<E> of(E e, E e2) {
return copyFromElements(e, e2);
}
public static <E> ImmutableMultiset<E> of(E e, E e2, E e3) {
return copyFromElements(e, e2, e3);
}
public static <E> ImmutableMultiset<E> of(E e, E e2, E e3, E e4) {
return copyFromElements(e, e2, e3, e4);
}
public static <E> ImmutableMultiset<E> of(E e, E e2, E e3, E e4, E e5) {
return copyFromElements(e, e2, e3, e4, e5);
}
public static <E> ImmutableMultiset<E> of(E e, E e2, E e3, E e4, E e5, E e6, E... eArr) {
return new Builder().add((Object) e).add((Object) e2).add((Object) e3).add((Object) e4).add((Object) e5).add((Object) e6).add((Object[]) eArr).build();
}
public static <E> ImmutableMultiset<E> copyOf(E[] eArr) {
return copyFromElements(eArr);
}
public static <E> ImmutableMultiset<E> copyOf(Iterable<? extends E> iterable) {
if (iterable instanceof ImmutableMultiset) {
ImmutableMultiset<E> immutableMultiset = (ImmutableMultiset) iterable;
if (!immutableMultiset.isPartialView()) {
return immutableMultiset;
}
}
Builder builder = new Builder(Multisets.inferDistinctElements(iterable));
builder.addAll((Iterable) iterable);
return builder.build();
}
public static <E> ImmutableMultiset<E> copyOf(Iterator<? extends E> it) {
return new Builder().addAll((Iterator) it).build();
}
private static <E> ImmutableMultiset<E> copyFromElements(E... eArr) {
return new Builder().add((Object[]) eArr).build();
}
static <E> ImmutableMultiset<E> copyFromEntries(Collection<? extends Multiset.Entry<? extends E>> collection) {
Builder builder = new Builder(collection.size());
for (Multiset.Entry entry : collection) {
builder.addCopies(entry.getElement(), entry.getCount());
}
return builder.build();
}
ImmutableMultiset() {
}
public UnmodifiableIterator<E> iterator() {
final UnmodifiableIterator it = entrySet().iterator();
return new UnmodifiableIterator<E>(this) {
@CheckForNull
E element;
int remaining;
public boolean hasNext() {
return this.remaining > 0 || it.hasNext();
}
public E next() {
if (this.remaining <= 0) {
Multiset.Entry entry = (Multiset.Entry) it.next();
this.element = entry.getElement();
this.remaining = entry.getCount();
}
this.remaining--;
E e = this.element;
Objects.requireNonNull(e);
return e;
}
};
}
public ImmutableList<E> asList() {
ImmutableList<E> immutableList = this.asList;
if (immutableList != null) {
return immutableList;
}
ImmutableList<E> asList2 = super.asList();
this.asList = asList2;
return asList2;
}
public boolean contains(@CheckForNull Object obj) {
return count(obj) > 0;
}
@Deprecated
public final int add(E e, int i) {
throw new UnsupportedOperationException();
}
@Deprecated
public final int remove(@CheckForNull Object obj, int i) {
throw new UnsupportedOperationException();
}
@Deprecated
public final int setCount(E e, int i) {
throw new UnsupportedOperationException();
}
@Deprecated
public final boolean setCount(E e, int i, int i2) {
throw new UnsupportedOperationException();
}
/* access modifiers changed from: package-private */
public int copyIntoArray(Object[] objArr, int i) {
UnmodifiableIterator it = entrySet().iterator();
while (it.hasNext()) {
Multiset.Entry entry = (Multiset.Entry) it.next();
Arrays.fill(objArr, i, entry.getCount() + i, entry.getElement());
i += entry.getCount();
}
return i;
}
public boolean equals(@CheckForNull Object obj) {
return Multisets.equalsImpl(this, obj);
}
public int hashCode() {
return Sets.hashCodeImpl(entrySet());
}
public String toString() {
return entrySet().toString();
}
public ImmutableSet<Multiset.Entry<E>> entrySet() {
ImmutableSet<Multiset.Entry<E>> immutableSet = this.entrySet;
if (immutableSet != null) {
return immutableSet;
}
ImmutableSet<Multiset.Entry<E>> createEntrySet = createEntrySet();
this.entrySet = createEntrySet;
return createEntrySet;
}
private ImmutableSet<Multiset.Entry<E>> createEntrySet() {
return isEmpty() ? ImmutableSet.of() : new EntrySet();
}
private final class EntrySet extends IndexedImmutableSet<Multiset.Entry<E>> {
private static final long serialVersionUID = 0;
private EntrySet() {
}
/* access modifiers changed from: package-private */
public boolean isPartialView() {
return ImmutableMultiset.this.isPartialView();
}
/* access modifiers changed from: package-private */
public Multiset.Entry<E> get(int i) {
return ImmutableMultiset.this.getEntry(i);
}
public int size() {
return ImmutableMultiset.this.elementSet().size();
}
public boolean contains(@CheckForNull Object obj) {
if (!(obj instanceof Multiset.Entry)) {
return false;
}
Multiset.Entry entry = (Multiset.Entry) obj;
if (entry.getCount() > 0 && ImmutableMultiset.this.count(entry.getElement()) == entry.getCount()) {
return true;
}
return false;
}
public int hashCode() {
return ImmutableMultiset.this.hashCode();
}
/* access modifiers changed from: package-private */
public Object writeReplace() {
return new EntrySetSerializedForm(ImmutableMultiset.this);
}
}
static class EntrySetSerializedForm<E> implements Serializable {
final ImmutableMultiset<E> multiset;
EntrySetSerializedForm(ImmutableMultiset<E> immutableMultiset) {
this.multiset = immutableMultiset;
}
/* access modifiers changed from: package-private */
public Object readResolve() {
return this.multiset.entrySet();
}
}
public static <E> Builder<E> builder() {
return new Builder<>();
}
public static class Builder<E> extends ImmutableCollection.Builder<E> {
boolean buildInvoked;
@CheckForNull
ObjectCountHashMap<E> contents;
boolean isLinkedHash;
public Builder() {
this(4);
}
Builder(int i) {
this.buildInvoked = false;
this.isLinkedHash = false;
this.contents = ObjectCountHashMap.createWithExpectedSize(i);
}
Builder(boolean z) {
this.buildInvoked = false;
this.isLinkedHash = false;
this.contents = null;
}
public Builder<E> add(E e) {
return addCopies(e, 1);
}
public Builder<E> add(E... eArr) {
super.add(eArr);
return this;
}
public Builder<E> addCopies(E e, int i) {
Objects.requireNonNull(this.contents);
if (i == 0) {
return this;
}
if (this.buildInvoked) {
this.contents = new ObjectCountHashMap<>(this.contents);
this.isLinkedHash = false;
}
this.buildInvoked = false;
Preconditions.checkNotNull(e);
ObjectCountHashMap<E> objectCountHashMap = this.contents;
objectCountHashMap.put(e, i + objectCountHashMap.get(e));
return this;
}
public Builder<E> setCount(E e, int i) {
Objects.requireNonNull(this.contents);
if (i == 0 && !this.isLinkedHash) {
this.contents = new ObjectCountLinkedHashMap(this.contents);
this.isLinkedHash = true;
} else if (this.buildInvoked) {
this.contents = new ObjectCountHashMap<>(this.contents);
this.isLinkedHash = false;
}
this.buildInvoked = false;
Preconditions.checkNotNull(e);
if (i == 0) {
this.contents.remove(e);
} else {
this.contents.put(Preconditions.checkNotNull(e), i);
}
return this;
}
public Builder<E> addAll(Iterable<? extends E> iterable) {
Objects.requireNonNull(this.contents);
if (iterable instanceof Multiset) {
Multiset<? extends E> cast = Multisets.cast(iterable);
ObjectCountHashMap<T> tryGetMap = tryGetMap(cast);
if (tryGetMap != null) {
ObjectCountHashMap<E> objectCountHashMap = this.contents;
objectCountHashMap.ensureCapacity(Math.max(objectCountHashMap.size(), tryGetMap.size()));
for (int firstIndex = tryGetMap.firstIndex(); firstIndex >= 0; firstIndex = tryGetMap.nextIndex(firstIndex)) {
addCopies(tryGetMap.getKey(firstIndex), tryGetMap.getValue(firstIndex));
}
} else {
Set<Multiset.Entry<? extends E>> entrySet = cast.entrySet();
ObjectCountHashMap<E> objectCountHashMap2 = this.contents;
objectCountHashMap2.ensureCapacity(Math.max(objectCountHashMap2.size(), entrySet.size()));
for (Multiset.Entry next : cast.entrySet()) {
addCopies(next.getElement(), next.getCount());
}
}
} else {
super.addAll(iterable);
}
return this;
}
public Builder<E> addAll(Iterator<? extends E> it) {
super.addAll(it);
return this;
}
@CheckForNull
static <T> ObjectCountHashMap<T> tryGetMap(Iterable<T> iterable) {
if (iterable instanceof RegularImmutableMultiset) {
return ((RegularImmutableMultiset) iterable).contents;
}
if (iterable instanceof AbstractMapBasedMultiset) {
return ((AbstractMapBasedMultiset) iterable).backingMap;
}
return null;
}
public ImmutableMultiset<E> build() {
Objects.requireNonNull(this.contents);
if (this.contents.size() == 0) {
return ImmutableMultiset.of();
}
if (this.isLinkedHash) {
this.contents = new ObjectCountHashMap<>(this.contents);
this.isLinkedHash = false;
}
this.buildInvoked = true;
return new RegularImmutableMultiset(this.contents);
}
}
}
Download file