// "Create function" "false" // ERROR: A 'return' expression required in a function with a block body ('{...}') // ERROR: The expression cannot be a selector (occur after a dot) // ERROR: Type inference failed: inline fun Iterable.firstOrNull(predicate: (T) -> Boolean): T?
cannot be applied to
receiver: Collection> arguments: ((List) -> () -> Boolean)
// ERROR: Type mismatch: inferred type is (List) -> () -> Boolean but (List) -> Boolean was expected // ERROR: Unresolved reference: maximumSizeOfGroup fun doSomethingStrangeWithCollection(collection: Collection): Collection? { val groupsByLength = collection.groupBy { s -> { s.length } } val maximumSizeOfGroup = groupsByLength.values.maxBy { it.size }. return groupsByLength.values.firstOrNull { group -> {group.size == maximumSizeOfGroup} } }