package com.google.firebase.firestore.model; import java.util.ArrayList; import java.util.Collections; import java.util.List; /* loaded from: classes2.dex */ public final class ResourcePath extends BasePath { public static final ResourcePath EMPTY = new ResourcePath(Collections.emptyList()); @Override // com.google.firebase.firestore.model.BasePath final /* bridge */ /* synthetic */ ResourcePath createPathWithSegments(List list) { return createPathWithSegments2((List) list); } private ResourcePath(List list) { super(list); } @Override // com.google.firebase.firestore.model.BasePath /* renamed from: createPathWithSegments, reason: avoid collision after fix types in other method */ final ResourcePath createPathWithSegments2(List list) { return new ResourcePath(list); } public static ResourcePath fromSegments(List list) { return list.isEmpty() ? EMPTY : new ResourcePath(list); } public static ResourcePath fromString(String str) { if (str.contains("//")) { StringBuilder sb = new StringBuilder("Invalid path ("); sb.append(str); sb.append("). Paths must not contain // in them."); throw new IllegalArgumentException(sb.toString()); } String[] split = str.split("/"); ArrayList arrayList = new ArrayList(split.length); for (String str2 : split) { if (!str2.isEmpty()) { arrayList.add(str2); } } return new ResourcePath(arrayList); } @Override // com.google.firebase.firestore.model.BasePath public final String canonicalString() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < this.segments.size(); i++) { if (i > 0) { sb.append("/"); } sb.append(this.segments.get(i)); } return sb.toString(); } }