Skip to content

Commit ec641ba

Browse files
authored
Merge pull request #212 from MaxKellermann/Dispatcher_containsKey
lib/Dispatcher: eliminate the HashMap.containsKey() call
2 parents a480f5e + 9207e9e commit ec641ba

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

aat-lib/src/main/java/ch/bailu/aat_lib/dispatcher/Dispatcher.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ class Dispatcher : DispatcherInterface {
2929
}
3030

3131
private fun getTargetList(iid: Int): TargetList {
32-
if (!targets.containsKey(iid)) {
33-
targets[iid] = TargetList()
32+
var list = targets[iid]
33+
if (list == null) {
34+
list = TargetList()
35+
targets[iid] = list
3436
}
35-
return targets[iid]!!
37+
return list
3638
}
3739

3840
override fun addSource(source: SourceInterface) {

0 commit comments

Comments
 (0)