Rabbit-R1/switch port/java/sources/com/google/common/collect/ImmutableMapEntrySet.java

100 lines
3.6 KiB
Java
Raw Normal View History

2024-05-21 16:08:36 -05:00
package com.google.common.collect;
import java.io.Serializable;
import java.util.Map;
import javax.annotation.CheckForNull;
/* JADX INFO: Access modifiers changed from: package-private */
@ElementTypesAreNonnullByDefault
/* loaded from: classes3.dex */
public abstract class ImmutableMapEntrySet<K, V> extends ImmutableSet<Map.Entry<K, V>> {
abstract ImmutableMap<K, V> map();
/* loaded from: classes3.dex */
static final class RegularEntrySet<K, V> extends ImmutableMapEntrySet<K, V> {
private final transient ImmutableList<Map.Entry<K, V>> entries;
private final transient ImmutableMap<K, V> map;
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableSet
public ImmutableList<Map.Entry<K, V>> createAsList() {
return this.entries;
}
@Override // com.google.common.collect.ImmutableMapEntrySet
ImmutableMap<K, V> map() {
return this.map;
}
RegularEntrySet(ImmutableMap<K, V> immutableMap, Map.Entry<K, V>[] entryArr) {
this(immutableMap, ImmutableList.asImmutableList(entryArr));
}
RegularEntrySet(ImmutableMap<K, V> immutableMap, ImmutableList<Map.Entry<K, V>> immutableList) {
this.map = immutableMap;
this.entries = immutableList;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableCollection
public int copyIntoArray(Object[] objArr, int i) {
return this.entries.copyIntoArray(objArr, i);
}
@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, com.google.common.collect.SortedIterable
public UnmodifiableIterator<Map.Entry<K, V>> iterator() {
return this.entries.iterator();
}
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return map().size();
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(@CheckForNull Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
V v = map().get(entry.getKey());
return v != null && v.equals(entry.getValue());
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableCollection
public boolean isPartialView() {
return map().isPartialView();
}
@Override // com.google.common.collect.ImmutableSet
boolean isHashCodeFast() {
return map().isHashCodeFast();
}
@Override // com.google.common.collect.ImmutableSet, java.util.Collection, java.util.Set
public int hashCode() {
return map().hashCode();
}
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection
Object writeReplace() {
return new EntrySetSerializedForm(map());
}
/* loaded from: classes3.dex */
private static class EntrySetSerializedForm<K, V> implements Serializable {
private static final long serialVersionUID = 0;
final ImmutableMap<K, V> map;
EntrySetSerializedForm(ImmutableMap<K, V> immutableMap) {
this.map = immutableMap;
}
Object readResolve() {
return this.map.entrySet();
}
}
}