using mapNotNull insteand of map + filterNotNull
This commit is contained in:
@@ -52,7 +52,7 @@ fun walkDaemons(registryDir: File,
|
|||||||
return registryDir.walk()
|
return registryDir.walk()
|
||||||
.map { Pair(it, portExtractor(it.name)) }
|
.map { Pair(it, portExtractor(it.name)) }
|
||||||
.filter { it.second != null && filter(it.first, it.second!!) }
|
.filter { it.second != null && filter(it.first, it.second!!) }
|
||||||
.map {
|
.mapNotNull {
|
||||||
assert(it.second!! > 0 && it.second!! < MAX_PORT_NUMBER)
|
assert(it.second!! > 0 && it.second!! < MAX_PORT_NUMBER)
|
||||||
report(DaemonReportCategory.DEBUG, "found daemon on port ${it.second}, trying to connect")
|
report(DaemonReportCategory.DEBUG, "found daemon on port ${it.second}, trying to connect")
|
||||||
val daemon = tryConnectToDaemon(it.second!!, report)
|
val daemon = tryConnectToDaemon(it.second!!, report)
|
||||||
@@ -62,7 +62,6 @@ fun walkDaemons(registryDir: File,
|
|||||||
}
|
}
|
||||||
daemon
|
daemon
|
||||||
}
|
}
|
||||||
.filterNotNull()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ class CompileServiceImpl(
|
|||||||
|
|
||||||
override fun getClients(): CompileService.CallResult<List<String>> = ifAlive {
|
override fun getClients(): CompileService.CallResult<List<String>> = ifAlive {
|
||||||
synchronized(state.clientProxies) {
|
synchronized(state.clientProxies) {
|
||||||
state.clientProxies.map { it.aliveFlagPath }.filterNotNull()
|
state.clientProxies.mapNotNull { it.aliveFlagPath }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user