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

106 lines
3.7 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.common.collect;
import java.io.Serializable;
import java.util.Iterator;
import java.util.Map;
/* loaded from: classes2.dex */
final class ImmutableMapValues<K, V> extends ImmutableCollection<V> {
private final ImmutableMap<K, V> map;
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableCollection
public final boolean isPartialView() {
return true;
}
@Override // 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 ImmutableMapValues(ImmutableMap<K, V> immutableMap) {
this.map = immutableMap;
}
@Override // java.util.AbstractCollection, java.util.Collection
public final int size() {
return this.map.size();
}
@Override // 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<V> iterator() {
return new UnmodifiableIterator<V>(this) { // from class: com.google.common.collect.ImmutableMapValues.1
final UnmodifiableIterator<Map.Entry<K, V>> entryItr;
final ImmutableMapValues this$0;
{
this.this$0 = this;
this.entryItr = this.map.entrySet().iterator();
}
@Override // java.util.Iterator
public boolean hasNext() {
return this.entryItr.hasNext();
}
@Override // java.util.Iterator
public V next() {
return this.entryItr.next().getValue();
}
};
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public final boolean contains(Object obj) {
return obj != null && Iterators.contains(iterator(), obj);
}
@Override // com.google.common.collect.ImmutableCollection
public final ImmutableList<V> asList() {
return new ImmutableList<V>(this, this.map.entrySet().asList()) { // from class: com.google.common.collect.ImmutableMapValues.2
final ImmutableList val$entryList;
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableCollection
public boolean isPartialView() {
return true;
}
{
this.val$entryList = r2;
}
@Override // java.util.List
public V get(int i) {
return (V) ((Map.Entry) this.val$entryList.get(i)).getValue();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return this.val$entryList.size();
}
};
}
@Override // com.google.common.collect.ImmutableCollection
final Object writeReplace() {
return new SerializedForm(this.map);
}
/* loaded from: classes2.dex */
static class SerializedForm<V> implements Serializable {
private static final long serialVersionUID = 0;
final ImmutableMap<?, V> map;
SerializedForm(ImmutableMap<?, V> immutableMap) {
this.map = immutableMap;
}
Object readResolve() {
return this.map.values();
}
}
}