File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
library/src/main/java/com/hoc081098/viewbindingdelegate/internal Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,6 @@ insert_final_newline=true
9
9
ij_kotlin_imports_layout =*
10
10
disabled_rules =filename
11
11
[* .xml ]
12
- indent_size =4
12
+ indent_size =4
13
+ [* .gradle ]
14
+ indent_size =4
Original file line number Diff line number Diff line change @@ -35,16 +35,11 @@ internal sealed interface MethodCache {
35
35
}
36
36
37
37
private abstract class AbstractMethodCache : MethodCache {
38
- private val cache: MutableMap <Class <out ViewBinding >, Method > = ConcurrentHashMap ()
38
+ private val cache = ConcurrentHashMap <Class <out ViewBinding >, Method > ()
39
39
40
- override fun <T : ViewBinding > getOrPut (clazz : Class <T >) =
40
+ override fun <T : ViewBinding > getOrPut (clazz : Class <T >): Method =
41
41
measureNanoTime(" [${this ::class .java.simpleName} -getOrPut] class=$clazz " ) {
42
- cache[clazz]?.let { return @measureNanoTime it }
43
-
44
- clazz.findMethod().also {
45
- // Cache update.
46
- cache[clazz] = it
47
- }
42
+ cache.getOrPut(clazz) { clazz.findMethod() }
48
43
}
49
44
50
45
abstract fun <T : ViewBinding > Class<T>.findMethod (): Method
You can’t perform that action at this time.
0 commit comments