what-the-bank/sources/com/google/firebase/firestore/model/ResourcePath.java

59 lines
2.0 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
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<ResourcePath> {
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<String>) list);
}
private ResourcePath(List<String> 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<String> list) {
return new ResourcePath(list);
}
public static ResourcePath fromSegments(List<String> 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();
}
}