using mapNotNull insteand of map + filterNotNull

This commit is contained in:
Ilya Chernikov
2015-11-25 18:43:36 +01:00
parent fd81063134
commit 96a9634ace
2 changed files with 2 additions and 3 deletions
@@ -52,7 +52,7 @@ fun walkDaemons(registryDir: File,
return registryDir.walk()
.map { Pair(it, portExtractor(it.name)) }
.filter { it.second != null && filter(it.first, it.second!!) }
.map {
.mapNotNull {
assert(it.second!! > 0 && it.second!! < MAX_PORT_NUMBER)
report(DaemonReportCategory.DEBUG, "found daemon on port ${it.second}, trying to connect")
val daemon = tryConnectToDaemon(it.second!!, report)
@@ -62,7 +62,6 @@ fun walkDaemons(registryDir: File,
}
daemon
}
.filterNotNull()
}
@@ -142,7 +142,7 @@ class CompileServiceImpl(
override fun getClients(): CompileService.CallResult<List<String>> = ifAlive {
synchronized(state.clientProxies) {
state.clientProxies.map { it.aliveFlagPath }.filterNotNull()
state.clientProxies.mapNotNull { it.aliveFlagPath }
}
}