From 07d05de5927e34e75fc2d37a74f47cbec91ed43d Mon Sep 17 00:00:00 2001 From: Farouk Date: Mon, 11 Nov 2019 17:59:34 +0100 Subject: [PATCH] Replaced String concatenation with template --- .../samples/apps/iosched/shared/di/IOSchedViewModelFactory.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/src/main/java/com/google/samples/apps/iosched/shared/di/IOSchedViewModelFactory.kt b/shared/src/main/java/com/google/samples/apps/iosched/shared/di/IOSchedViewModelFactory.kt index 1699818c6a..07fa0a19f1 100644 --- a/shared/src/main/java/com/google/samples/apps/iosched/shared/di/IOSchedViewModelFactory.kt +++ b/shared/src/main/java/com/google/samples/apps/iosched/shared/di/IOSchedViewModelFactory.kt @@ -28,10 +28,10 @@ class IOSchedViewModelFactory @Inject constructor( private val creators: @JvmSuppressWildcards Map, Provider> ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): T { + override fun create(modelClass: Class): T { val found = creators.entries.find { modelClass.isAssignableFrom(it.key) } val creator = found?.value - ?: throw IllegalArgumentException("unknown model class " + modelClass) + ?: throw IllegalArgumentException("unknown model class $modelClass") try { @Suppress("UNCHECKED_CAST") return creator.get() as T