Replace map { ... }.filterNotNull() with mapNotNull { ... }
This commit is contained in:
@@ -48,8 +48,7 @@ public class IterableTypesDetection(
|
||||
|
||||
private val typesWithExtensionIterator: Collection<KotlinType> = scope
|
||||
.collectFunctions(iteratorName, NoLookupLocation.FROM_IDE)
|
||||
.map { it.extensionReceiverParameter }
|
||||
.filterNotNull()
|
||||
.mapNotNull { it.extensionReceiverParameter }
|
||||
.map { it.type }
|
||||
|
||||
override fun isIterable(type: FuzzyType, loopVarType: KotlinType?): Boolean {
|
||||
|
||||
@@ -189,8 +189,7 @@ public class KotlinIndicesHelper(
|
||||
|
||||
public fun getJvmClassesByName(name: String): Collection<ClassDescriptor> {
|
||||
return PsiShortNamesCache.getInstance(project).getClassesByName(name, scope)
|
||||
.map { it.resolveToDescriptor(resolutionFacade) }
|
||||
.filterNotNull()
|
||||
.mapNotNull { it.resolveToDescriptor(resolutionFacade) }
|
||||
.filter(descriptorFilter)
|
||||
.toSet()
|
||||
}
|
||||
|
||||
@@ -90,8 +90,7 @@ public object KotlinNameSuggester {
|
||||
val result = LinkedHashSet<String>()
|
||||
|
||||
suggestNamesByExpressionOnly(collection, bindingContext, { true })
|
||||
.map { StringUtil.unpluralize(it) }
|
||||
.filterNotNull()
|
||||
.mapNotNull { StringUtil.unpluralize(it) }
|
||||
.mapTo(result) { suggestNameByName(it, validator) }
|
||||
|
||||
result.addNamesByType(elementType, validator)
|
||||
|
||||
@@ -47,8 +47,7 @@ public object OptionalParametersHelper {
|
||||
val descriptor = resolvedCall.getResultingDescriptor()
|
||||
|
||||
val parameterToDefaultValue = descriptor.getValueParameters()
|
||||
.map { parameter -> defaultParameterValue(parameter, project)?.let { parameter to it } }
|
||||
.filterNotNull()
|
||||
.mapNotNull { parameter -> defaultParameterValue(parameter, project)?.let { parameter to it } }
|
||||
.toMap()
|
||||
if (parameterToDefaultValue.isEmpty()) return emptyList()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user