CrackMe.apk
Download file
package androidx.arch.core.internal;
import java.util.Iterator;
import java.util.Map;
import java.util.WeakHashMap;
public class SafeIterableMap<K, V> implements Iterable<Map.Entry<K, V>> {
private Entry<K, V> mEnd;
private WeakHashMap<SupportRemove<K, V>, Boolean> mIterators = new WeakHashMap<>();
private int mSize = 0;
Entry<K, V> mStart;
interface SupportRemove<K, V> {
void supportRemove(Entry<K, V> entry);
}
/* access modifiers changed from: protected */
public Entry<K, V> get(K k) {
Entry<K, V> entry = this.mStart;
while (entry != null && !entry.mKey.equals(k)) {
entry = entry.mNext;
}
return entry;
}
public V putIfAbsent(K k, V v) {
Entry entry = get(k);
if (entry != null) {
return entry.mValue;
}
put(k, v);
return null;
}
/* access modifiers changed from: protected */
public Entry<K, V> put(K k, V v) {
Entry<K, V> entry = new Entry<>(k, v);
this.mSize++;
Entry<K, V> entry2 = this.mEnd;
if (entry2 == null) {
this.mStart = entry;
this.mEnd = entry;
return entry;
}
entry2.mNext = entry;
entry.mPrevious = this.mEnd;
this.mEnd = entry;
return entry;
}
public V remove(K k) {
Entry entry = get(k);
if (entry == null) {
return null;
}
this.mSize--;
if (!this.mIterators.isEmpty()) {
for (SupportRemove<K, V> supportRemove : this.mIterators.keySet()) {
supportRemove.supportRemove(entry);
}
}
if (entry.mPrevious != null) {
entry.mPrevious.mNext = entry.mNext;
} else {
this.mStart = entry.mNext;
}
if (entry.mNext != null) {
entry.mNext.mPrevious = entry.mPrevious;
} else {
this.mEnd = entry.mPrevious;
}
entry.mNext = null;
entry.mPrevious = null;
return entry.mValue;
}
public int size() {
return this.mSize;
}
public Iterator<Map.Entry<K, V>> iterator() {
AscendingIterator ascendingIterator = new AscendingIterator(this.mStart, this.mEnd);
this.mIterators.put(ascendingIterator, false);
return ascendingIterator;
}
public Iterator<Map.Entry<K, V>> descendingIterator() {
DescendingIterator descendingIterator = new DescendingIterator(this.mEnd, this.mStart);
this.mIterators.put(descendingIterator, false);
return descendingIterator;
}
public SafeIterableMap<K, V>.IteratorWithAdditions iteratorWithAdditions() {
SafeIterableMap<K, V>.IteratorWithAdditions iteratorWithAdditions = new IteratorWithAdditions();
this.mIterators.put(iteratorWithAdditions, false);
return iteratorWithAdditions;
}
public Map.Entry<K, V> eldest() {
return this.mStart;
}
public Map.Entry<K, V> newest() {
return this.mEnd;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof SafeIterableMap)) {
return false;
}
SafeIterableMap safeIterableMap = (SafeIterableMap) obj;
if (size() != safeIterableMap.size()) {
return false;
}
Iterator it = iterator();
Iterator it2 = safeIterableMap.iterator();
while (it.hasNext() && it2.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
Object next = it2.next();
if ((entry == null && next != null) || (entry != null && !entry.equals(next))) {
return false;
}
}
if (it.hasNext() || it2.hasNext()) {
return false;
}
return true;
}
public int hashCode() {
Iterator it = iterator();
int i = 0;
while (it.hasNext()) {
i += ((Map.Entry) it.next()).hashCode();
}
return i;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[");
Iterator it = iterator();
while (it.hasNext()) {
sb.append(((Map.Entry) it.next()).toString());
if (it.hasNext()) {
sb.append(", ");
}
}
sb.append("]");
return sb.toString();
}
private static abstract class ListIterator<K, V> implements Iterator<Map.Entry<K, V>>, SupportRemove<K, V> {
Entry<K, V> mExpectedEnd;
Entry<K, V> mNext;
/* access modifiers changed from: package-private */
public abstract Entry<K, V> backward(Entry<K, V> entry);
/* access modifiers changed from: package-private */
public abstract Entry<K, V> forward(Entry<K, V> entry);
ListIterator(Entry<K, V> entry, Entry<K, V> entry2) {
this.mExpectedEnd = entry2;
this.mNext = entry;
}
public boolean hasNext() {
return this.mNext != null;
}
public void supportRemove(Entry<K, V> entry) {
if (this.mExpectedEnd == entry && entry == this.mNext) {
this.mNext = null;
this.mExpectedEnd = null;
}
Entry<K, V> entry2 = this.mExpectedEnd;
if (entry2 == entry) {
this.mExpectedEnd = backward(entry2);
}
if (this.mNext == entry) {
this.mNext = nextNode();
}
}
private Entry<K, V> nextNode() {
Entry<K, V> entry = this.mNext;
Entry<K, V> entry2 = this.mExpectedEnd;
if (entry == entry2 || entry2 == null) {
return null;
}
return forward(entry);
}
public Map.Entry<K, V> next() {
Entry<K, V> entry = this.mNext;
this.mNext = nextNode();
return entry;
}
}
static class AscendingIterator<K, V> extends ListIterator<K, V> {
AscendingIterator(Entry<K, V> entry, Entry<K, V> entry2) {
super(entry, entry2);
}
/* access modifiers changed from: package-private */
public Entry<K, V> forward(Entry<K, V> entry) {
return entry.mNext;
}
/* access modifiers changed from: package-private */
public Entry<K, V> backward(Entry<K, V> entry) {
return entry.mPrevious;
}
}
private static class DescendingIterator<K, V> extends ListIterator<K, V> {
DescendingIterator(Entry<K, V> entry, Entry<K, V> entry2) {
super(entry, entry2);
}
/* access modifiers changed from: package-private */
public Entry<K, V> forward(Entry<K, V> entry) {
return entry.mPrevious;
}
/* access modifiers changed from: package-private */
public Entry<K, V> backward(Entry<K, V> entry) {
return entry.mNext;
}
}
private class IteratorWithAdditions implements Iterator<Map.Entry<K, V>>, SupportRemove<K, V> {
private boolean mBeforeStart = true;
private Entry<K, V> mCurrent;
IteratorWithAdditions() {
}
public void supportRemove(Entry<K, V> entry) {
Entry<K, V> entry2 = this.mCurrent;
if (entry == entry2) {
Entry<K, V> entry3 = entry2.mPrevious;
this.mCurrent = entry3;
this.mBeforeStart = entry3 == null;
}
}
public boolean hasNext() {
if (!this.mBeforeStart) {
Entry<K, V> entry = this.mCurrent;
if (entry == null || entry.mNext == null) {
return false;
}
return true;
} else if (SafeIterableMap.this.mStart != null) {
return true;
} else {
return false;
}
}
public Map.Entry<K, V> next() {
if (this.mBeforeStart) {
this.mBeforeStart = false;
this.mCurrent = SafeIterableMap.this.mStart;
} else {
Entry<K, V> entry = this.mCurrent;
this.mCurrent = entry != null ? entry.mNext : null;
}
return this.mCurrent;
}
}
static class Entry<K, V> implements Map.Entry<K, V> {
final K mKey;
Entry<K, V> mNext;
Entry<K, V> mPrevious;
final V mValue;
Entry(K k, V v) {
this.mKey = k;
this.mValue = v;
}
public K getKey() {
return this.mKey;
}
public V getValue() {
return this.mValue;
}
public V setValue(V v) {
throw new UnsupportedOperationException("An entry modification is not supported");
}
public String toString() {
return this.mKey + "=" + this.mValue;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof Entry)) {
return false;
}
Entry entry = (Entry) obj;
if (!this.mKey.equals(entry.mKey) || !this.mValue.equals(entry.mValue)) {
return false;
}
return true;
}
public int hashCode() {
return this.mKey.hashCode() ^ this.mValue.hashCode();
}
}
}
Download file