package com.facetec.sdk; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; /* loaded from: classes.dex */ public final class jv { private final String[] b; jv(a aVar) { this.b = (String[]) aVar.c.toArray(new String[aVar.c.size()]); } public final int c() { return this.b.length / 2; } public final String c(int i) { return this.b[i << 1]; } public final String a(int i) { return this.b[(i << 1) + 1]; } public final a e() { a aVar = new a(); Collections.addAll(aVar.c, this.b); return aVar; } public final boolean equals(Object obj) { return (obj instanceof jv) && Arrays.equals(((jv) obj).b, this.b); } public final int hashCode() { return Arrays.hashCode(this.b); } public final String toString() { StringBuilder sb = new StringBuilder(); int c = c(); for (int i = 0; i < c; i++) { sb.append(c(i)); sb.append(": "); sb.append(a(i)); sb.append("\n"); } return sb.toString(); } static void a(String str) { if (str == null) { throw new NullPointerException("name == null"); } if (str.isEmpty()) { throw new IllegalArgumentException("name is empty"); } int length = str.length(); for (int i = 0; i < length; i++) { char charAt = str.charAt(i); if (charAt <= ' ' || charAt >= 127) { throw new IllegalArgumentException(km.a("Unexpected char %#04x at %d in header name: %s", Integer.valueOf(charAt), Integer.valueOf(i), str)); } } } static void d(String str, String str2) { if (str == null) { StringBuilder sb = new StringBuilder("value for name "); sb.append(str2); sb.append(" == null"); throw new NullPointerException(sb.toString()); } int length = str.length(); for (int i = 0; i < length; i++) { char charAt = str.charAt(i); if ((charAt <= 31 && charAt != '\t') || charAt >= 127) { throw new IllegalArgumentException(km.a("Unexpected char %#04x at %d in %s value: %s", Integer.valueOf(charAt), Integer.valueOf(i), str2, str)); } } } /* loaded from: classes.dex */ public static final class a { final List c = new ArrayList(20); public final a b(String str, String str2) { jv.a(str); jv.d(str2, str); return c(str, str2); } /* JADX INFO: Access modifiers changed from: package-private */ public final a c(String str, String str2) { this.c.add(str); this.c.add(str2.trim()); return this; } public final a b(String str) { int i = 0; while (i < this.c.size()) { if (str.equalsIgnoreCase(this.c.get(i))) { this.c.remove(i); this.c.remove(i); i -= 2; } i += 2; } return this; } public final a a(String str, String str2) { jv.a(str); jv.d(str2, str); b(str); c(str, str2); return this; } public final jv e() { return new jv(this); } } public final String e(String str) { String[] strArr = this.b; for (int length = strArr.length - 2; length >= 0; length -= 2) { if (str.equalsIgnoreCase(strArr[length])) { return strArr[length + 1]; } } return null; } }