mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-12-06 12:29:32 +01:00
41 lines
1.4 KiB
Java
41 lines
1.4 KiB
Java
package com.google.common.escape;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.VisibleForTesting;
|
|
import com.google.common.base.Preconditions;
|
|
import java.lang.reflect.Array;
|
|
import java.util.Collections;
|
|
import java.util.Map;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@GwtCompatible
|
|
/* loaded from: classes8.dex */
|
|
public final class ArrayBasedEscaperMap {
|
|
private static final char[][] EMPTY_REPLACEMENT_ARRAY = (char[][]) Array.newInstance((Class<?>) Character.TYPE, 0, 0);
|
|
private final char[][] replacementArray;
|
|
|
|
private ArrayBasedEscaperMap(char[][] cArr) {
|
|
this.replacementArray = cArr;
|
|
}
|
|
|
|
public static ArrayBasedEscaperMap create(Map<Character, String> map) {
|
|
return new ArrayBasedEscaperMap(createReplacementArray(map));
|
|
}
|
|
|
|
@VisibleForTesting
|
|
public static char[][] createReplacementArray(Map<Character, String> map) {
|
|
Preconditions.checkNotNull(map);
|
|
if (map.isEmpty()) {
|
|
return EMPTY_REPLACEMENT_ARRAY;
|
|
}
|
|
char[][] cArr = new char[((Character) Collections.max(map.keySet())).charValue() + 1][];
|
|
for (Character ch : map.keySet()) {
|
|
cArr[ch.charValue()] = map.get(ch).toCharArray();
|
|
}
|
|
return cArr;
|
|
}
|
|
|
|
public char[][] getReplacementArray() {
|
|
return this.replacementArray;
|
|
}
|
|
}
|