Rabbit-R1/switch port/smali/smali_classes3/io/sentry/util/CollectionUtils.smali
2024-05-21 17:08:36 -04:00

440 lines
9.4 KiB
Smali

.class public final Lio/sentry/util/CollectionUtils;
.super Ljava/lang/Object;
.source "CollectionUtils.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lio/sentry/util/CollectionUtils$Predicate;,
Lio/sentry/util/CollectionUtils$Mapper;
}
.end annotation
# direct methods
.method private constructor <init>()V
.locals 0
.line 17
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static contains([Ljava/lang/Object;Ljava/lang/Object;)Z
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">([TT;TT;)Z"
}
.end annotation
.line 156
array-length v0, p0
const/4 v1, 0x0
move v2, v1
:goto_0
if-ge v2, v0, :cond_1
aget-object v3, p0, v2
.line 157
invoke-virtual {p1, v3}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_0
const/4 p0, 0x1
return p0
:cond_0
add-int/lit8 v2, v2, 0x1
goto :goto_0
:cond_1
return v1
.end method
.method public static filterListEntries(Ljava/util/List;Lio/sentry/util/CollectionUtils$Predicate;)Ljava/util/List;
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(",
"Ljava/util/List<",
"TT;>;",
"Lio/sentry/util/CollectionUtils$Predicate<",
"TT;>;)",
"Ljava/util/List<",
"TT;>;"
}
.end annotation
.line 139
new-instance v0, Ljava/util/ArrayList;
invoke-interface {p0}, Ljava/util/List;->size()I
move-result v1
invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(I)V
.line 140
invoke-interface {p0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object p0
:cond_0
:goto_0
invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_1
invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
.line 141
invoke-interface {p1, v1}, Lio/sentry/util/CollectionUtils$Predicate;->test(Ljava/lang/Object;)Z
move-result v2
if-eqz v2, :cond_0
.line 142
invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
goto :goto_0
:cond_1
return-object v0
.end method
.method public static filterMapEntries(Ljava/util/Map;Lio/sentry/util/CollectionUtils$Predicate;)Ljava/util/Map;
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"<K:",
"Ljava/lang/Object;",
"V:",
"Ljava/lang/Object;",
">(",
"Ljava/util/Map<",
"TK;TV;>;",
"Lio/sentry/util/CollectionUtils$Predicate<",
"Ljava/util/Map$Entry<",
"TK;TV;>;>;)",
"Ljava/util/Map<",
"TK;TV;>;"
}
.end annotation
.line 103
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
.line 104
invoke-interface {p0}, Ljava/util/Map;->entrySet()Ljava/util/Set;
move-result-object p0
invoke-interface {p0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object p0
:cond_0
:goto_0
invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_1
invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/util/Map$Entry;
.line 105
invoke-interface {p1, v1}, Lio/sentry/util/CollectionUtils$Predicate;->test(Ljava/lang/Object;)Z
move-result v2
if-eqz v2, :cond_0
.line 106
invoke-interface {v1}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
move-result-object v2
invoke-interface {v1}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object v1
invoke-interface {v0, v2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_0
:cond_1
return-object v0
.end method
.method public static map(Ljava/util/List;Lio/sentry/util/CollectionUtils$Mapper;)Ljava/util/List;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
"R:",
"Ljava/lang/Object;",
">(",
"Ljava/util/List<",
"TT;>;",
"Lio/sentry/util/CollectionUtils$Mapper<",
"TT;TR;>;)",
"Ljava/util/List<",
"TR;>;"
}
.end annotation
.line 124
new-instance v0, Ljava/util/ArrayList;
invoke-interface {p0}, Ljava/util/List;->size()I
move-result v1
invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(I)V
.line 125
invoke-interface {p0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object p0
:goto_0
invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_0
invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
.line 126
invoke-interface {p1, v1}, Lio/sentry/util/CollectionUtils$Mapper;->map(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
goto :goto_0
:cond_0
return-object v0
.end method
.method public static newArrayList(Ljava/util/List;)Ljava/util/List;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(",
"Ljava/util/List<",
"TT;>;)",
"Ljava/util/List<",
"TT;>;"
}
.end annotation
if-eqz p0, :cond_0
.line 86
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0, p0}, Ljava/util/ArrayList;-><init>(Ljava/util/Collection;)V
return-object v0
:cond_0
const/4 p0, 0x0
return-object p0
.end method
.method public static newConcurrentHashMap(Ljava/util/Map;)Ljava/util/Map;
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"<K:",
"Ljava/lang/Object;",
"V:",
"Ljava/lang/Object;",
">(",
"Ljava/util/Map<",
"TK;TV;>;)",
"Ljava/util/Map<",
"TK;TV;>;"
}
.end annotation
if-eqz p0, :cond_2
.line 48
new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;
invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
.line 50
invoke-interface {p0}, Ljava/util/Map;->entrySet()Ljava/util/Set;
move-result-object p0
invoke-interface {p0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object p0
:cond_0
:goto_0
invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_1
invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/util/Map$Entry;
.line 51
invoke-interface {v1}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
move-result-object v2
if-eqz v2, :cond_0
invoke-interface {v1}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object v2
if-eqz v2, :cond_0
.line 52
invoke-interface {v1}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
move-result-object v2
invoke-interface {v1}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object v1
invoke-interface {v0, v2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_0
:cond_1
return-object v0
:cond_2
const/4 p0, 0x0
return-object p0
.end method
.method public static newHashMap(Ljava/util/Map;)Ljava/util/Map;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"<K:",
"Ljava/lang/Object;",
"V:",
"Ljava/lang/Object;",
">(",
"Ljava/util/Map<",
"TK;TV;>;)",
"Ljava/util/Map<",
"TK;TV;>;"
}
.end annotation
if-eqz p0, :cond_0
.line 71
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0, p0}, Ljava/util/HashMap;-><init>(Ljava/util/Map;)V
return-object v0
:cond_0
const/4 p0, 0x0
return-object p0
.end method
.method public static size(Ljava/lang/Iterable;)I
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/Iterable<",
"*>;)I"
}
.end annotation
.line 26
instance-of v0, p0, Ljava/util/Collection;
if-eqz v0, :cond_0
.line 27
check-cast p0, Ljava/util/Collection;
invoke-interface {p0}, Ljava/util/Collection;->size()I
move-result p0
return p0
.line 30
:cond_0
invoke-interface {p0}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
move-result-object p0
const/4 v0, 0x0
:goto_0
invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_1
invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
add-int/lit8 v0, v0, 0x1
goto :goto_0
:cond_1
return v0
.end method