package com.google.common.escape; import com.google.common.base.Preconditions; import java.lang.reflect.Array; import java.util.Collections; import java.util.Iterator; import java.util.Map; /* loaded from: classes2.dex */ public final class ArrayBasedEscaperMap { private static final char[][] EMPTY_REPLACEMENT_ARRAY = (char[][]) Array.newInstance((Class) Character.TYPE, 0, 0); private final char[][] replacementArray; public static ArrayBasedEscaperMap create(Map map) { return new ArrayBasedEscaperMap(createReplacementArray(map)); } private ArrayBasedEscaperMap(char[][] cArr) { this.replacementArray = cArr; } static char[][] createReplacementArray(Map map) { Preconditions.checkNotNull(map); if (map.isEmpty()) { return EMPTY_REPLACEMENT_ARRAY; } char[][] cArr = new char[((Character) Collections.max(map.keySet())).charValue() + 1]; Iterator it = map.keySet().iterator(); while (it.hasNext()) { char charValue = it.next().charValue(); cArr[charValue] = map.get(Character.valueOf(charValue)).toCharArray(); } return cArr; } /* JADX INFO: Access modifiers changed from: package-private */ public final char[][] getReplacementArray() { return this.replacementArray; } }