We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
getOrPut
1 parent 88feb63 commit 785785aCopy full SHA for 785785a
firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAIMultiResourceComponent.kt
@@ -41,14 +41,14 @@ internal class FirebaseAIMultiResourceComponent(
41
42
fun get(backend: GenerativeBackend): FirebaseAI =
43
synchronized(this) {
44
- instances[backend.location]
45
- ?: FirebaseAI(
46
- app,
47
- backend,
48
- blockingDispatcher,
49
- appCheckProvider,
50
- internalAuthProvider,
51
- )
52
- .also { instances[backend.location] = it }
+ instances.getOrPut(backend.location) {
+ FirebaseAI(
+ app,
+ backend,
+ blockingDispatcher,
+ appCheckProvider,
+ internalAuthProvider,
+ )
+ }
53
}
54
0 commit comments