granularity level: instruction
.class Lcom/google/firebase/components/LazySet;
.super Ljava/lang/Object;
.source "LazySet.java"
.implements Lcom/google/firebase/inject/Provider;
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">",
"Ljava/lang/Object;",
"Lcom/google/firebase/inject/Provider<",
"Ljava/util/Set<",
"TT;>;>;"
}
.end annotation
.field private volatile actualSet:Ljava/util/Set;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Set<",
"TT;>;"
}
.end annotation
.end field
.field private volatile providers:Ljava/util/Set;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Set<",
"Lcom/google/firebase/inject/Provider<",
"TT;>;>;"
}
.end annotation
.end field
.method constructor <init>(Ljava/util/Collection;)V
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/Collection<",
"Lcom/google/firebase/inject/Provider<",
"TT;>;>;)V"
}
.end annotation
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const/4 v0, 0x0
iput-object v0, p0, Lcom/google/firebase/components/LazySet;->actualSet:Ljava/util/Set;
new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;
invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
invoke-static {v0}, Ljava/util/Collections;->newSetFromMap(Ljava/util/Map;)Ljava/util/Set;
move-result-object v0
iput-object v0, p0, Lcom/google/firebase/components/LazySet;->providers:Ljava/util/Set;
iget-object v0, p0, Lcom/google/firebase/components/LazySet;->providers:Ljava/util/Set;
invoke-interface {v0, p1}, Ljava/util/Set;->addAll(Ljava/util/Collection;)Z
return-void
.end method
.method static fromCollection(Ljava/util/Collection;)Lcom/google/firebase/components/LazySet;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/Collection<",
"Lcom/google/firebase/inject/Provider<",
"*>;>;)",
"Lcom/google/firebase/components/LazySet<",
"*>;"
}
.end annotation
check-cast p0, Ljava/util/Set;
new-instance v0, Lcom/google/firebase/components/LazySet;
invoke-direct {v0, p0}, Lcom/google/firebase/components/LazySet;-><init>(Ljava/util/Collection;)V
return-object v0
.end method
.method private declared-synchronized updateSet()V
.locals 3
monitor-enter p0
:try_start_0
iget-object v0, p0, Lcom/google/firebase/components/LazySet;->providers:Ljava/util/Set;
invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object v0
:goto_0
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_0
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Lcom/google/firebase/inject/Provider;
iget-object v2, p0, Lcom/google/firebase/components/LazySet;->actualSet:Ljava/util/Set;
invoke-interface {v1}, Lcom/google/firebase/inject/Provider;->get()Ljava/lang/Object;
move-result-object v1
invoke-interface {v2, v1}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
goto :goto_0
:cond_0
const/4 v0, 0x0
iput-object v0, p0, Lcom/google/firebase/components/LazySet;->providers:Ljava/util/Set;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return-void
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method declared-synchronized add(Lcom/google/firebase/inject/Provider;)V
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/google/firebase/inject/Provider<",
"TT;>;)V"
}
.end annotation
return-void
.end method
.method public bridge synthetic get()Ljava/lang/Object;
.locals 1
invoke-virtual {p0}, Lcom/google/firebase/components/LazySet;->get()Ljava/util/Set;
move-result-object v0
return-object v0
.end method
.method public get()Ljava/util/Set;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/Set<",
"TT;>;"
}
.end annotation
iget-object v0, p0, Lcom/google/firebase/components/LazySet;->actualSet:Ljava/util/Set;
if-nez v0, :cond_1
monitor-enter p0
iget-object v0, p0, Lcom/google/firebase/components/LazySet;->actualSet:Ljava/util/Set;
if-nez v0, :cond_0
new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;
invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
invoke-static {v0}, Ljava/util/Collections;->newSetFromMap(Ljava/util/Map;)Ljava/util/Set;
move-result-object v0
iput-object v0, p0, Lcom/google/firebase/components/LazySet;->actualSet:Ljava/util/Set;
invoke-direct {p0}, Lcom/google/firebase/components/LazySet;->updateSet()V
:cond_0
monitor-exit p0
goto :goto_0
:catchall_0
move-exception v0
monitor-exit p0
:throw0
throw v0
:goto_0
:cond_1
iget-object v0, p0, Lcom/google/firebase/components/LazySet;->actualSet:Ljava/util/Set;
invoke-static {v0}, Ljava/util/Collections;->unmodifiableSet(Ljava/util/Set;)Ljava/util/Set;
move-result-object v0
return-object v0
.end method