package com.google.common.collect; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import java.io.Serializable; import java.lang.Enum; import java.util.EnumMap; import java.util.Map; import javax.annotation.CheckForNull; @ElementTypesAreNonnullByDefault /* loaded from: classes3.dex */ final class ImmutableEnumMap, V> extends ImmutableMap.IteratorBasedImmutableMap { private final transient EnumMap delegate; /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.ImmutableMap public boolean isPartialView() { return false; } /* JADX INFO: Access modifiers changed from: package-private */ public static , V> ImmutableMap asImmutable(EnumMap enumMap) { int size = enumMap.size(); if (size == 0) { return ImmutableMap.of(); } if (size == 1) { Map.Entry entry = (Map.Entry) Iterables.getOnlyElement(enumMap.entrySet()); return ImmutableMap.of((Enum) entry.getKey(), entry.getValue()); } return new ImmutableEnumMap(enumMap); } private ImmutableEnumMap(EnumMap enumMap) { this.delegate = enumMap; Preconditions.checkArgument(!enumMap.isEmpty()); } /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.ImmutableMap public UnmodifiableIterator keyIterator() { return Iterators.unmodifiableIterator(this.delegate.keySet().iterator()); } @Override // java.util.Map public int size() { return this.delegate.size(); } @Override // com.google.common.collect.ImmutableMap, java.util.Map public boolean containsKey(@CheckForNull Object obj) { return this.delegate.containsKey(obj); } @Override // com.google.common.collect.ImmutableMap, java.util.Map @CheckForNull public V get(@CheckForNull Object obj) { return this.delegate.get(obj); } @Override // com.google.common.collect.ImmutableMap, java.util.Map public boolean equals(@CheckForNull Object obj) { if (obj == this) { return true; } if (obj instanceof ImmutableEnumMap) { obj = ((ImmutableEnumMap) obj).delegate; } return this.delegate.equals(obj); } @Override // com.google.common.collect.ImmutableMap.IteratorBasedImmutableMap UnmodifiableIterator> entryIterator() { return Maps.unmodifiableEntryIterator(this.delegate.entrySet().iterator()); } @Override // com.google.common.collect.ImmutableMap Object writeReplace() { return new EnumSerializedForm(this.delegate); } /* loaded from: classes3.dex */ private static class EnumSerializedForm, V> implements Serializable { private static final long serialVersionUID = 0; final EnumMap delegate; EnumSerializedForm(EnumMap enumMap) { this.delegate = enumMap; } Object readResolve() { return new ImmutableEnumMap(this.delegate); } } }