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; /* loaded from: classes2.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 final 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(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 final UnmodifiableIterator keyIterator() { return Iterators.unmodifiableIterator(this.delegate.keySet().iterator()); } @Override // java.util.Map public final int size() { return this.delegate.size(); } @Override // com.google.common.collect.ImmutableMap, java.util.Map public final boolean containsKey(Object obj) { return this.delegate.containsKey(obj); } @Override // com.google.common.collect.ImmutableMap, java.util.Map public final V get(Object obj) { return this.delegate.get(obj); } @Override // com.google.common.collect.ImmutableMap, java.util.Map public final boolean equals(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 final UnmodifiableIterator> entryIterator() { return Maps.unmodifiableEntryIterator(this.delegate.entrySet().iterator()); } @Override // com.google.common.collect.ImmutableMap final Object writeReplace() { return new EnumSerializedForm(this.delegate); } /* loaded from: classes2.dex */ 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); } } }