discord-jadx/app/src/main/java/com/discord/stores/StoreApplicationCommandFrec...

60 lines
2.7 KiB
Java

package com.discord.stores;
import com.discord.utilities.frecency.FrecencyTracker;
import d0.g0.s;
import d0.g0.w;
import d0.t.g0;
import d0.t.h0;
import d0.t.u;
import d0.z.d.o;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
/* compiled from: StoreApplicationCommandFrecency.kt */
public final class StoreApplicationCommandFrecency$populateStore$1 extends o implements Function0<Unit> {
public final /* synthetic */ StoreApplicationCommandFrecency this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public StoreApplicationCommandFrecency$populateStore$1(StoreApplicationCommandFrecency storeApplicationCommandFrecency) {
super(0);
this.this$0 = storeApplicationCommandFrecency;
}
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public final void mo1invoke() {
LinkedHashMap linkedHashMap = new LinkedHashMap();
for (String str : FrecencyTracker.getSortedKeys$default(StoreApplicationCommandFrecency.access$getFrecency$p(this.this$0), 0, 1, null)) {
if (w.contains$default((CharSequence) str, (CharSequence) ":", false, 2, (Object) null)) {
List split$default = w.split$default((CharSequence) str, new String[]{":"}, false, 0, 6, (Object) null);
Long longOrNull = s.toLongOrNull((String) split$default.get(1));
long longValue = longOrNull != null ? longOrNull.longValue() : 0;
String str2 = (String) split$default.get(0);
List list = (List) linkedHashMap.get(Long.valueOf(longValue));
if (list == null) {
list = new ArrayList();
linkedHashMap.put(Long.valueOf(longValue), list);
}
list.add(str2);
} else {
List list2 = (List) linkedHashMap.get(0L);
if (list2 == null) {
list2 = new ArrayList();
linkedHashMap.put(0L, list2);
}
list2.add(str);
}
}
StoreApplicationCommandFrecency storeApplicationCommandFrecency = this.this$0;
LinkedHashMap linkedHashMap2 = new LinkedHashMap(g0.mapCapacity(linkedHashMap.size()));
for (Map.Entry entry : linkedHashMap.entrySet()) {
linkedHashMap2.put(entry.getKey(), u.toList((Iterable) entry.getValue()));
}
StoreApplicationCommandFrecency.access$setTopCommandIds$p(storeApplicationCommandFrecency, h0.toMutableMap(linkedHashMap2));
StoreApplicationCommandFrecency.access$setTopCommandIdsSnapshot$p(this.this$0, linkedHashMap);
}
}