fun notNullValues(collection: MutableCollection) { collection.removeIf { it.length > 5 } } fun nullableValues(collection: MutableCollection) { collection.removeIf { it != null && it.length > 5 } } fun nullableValues2(collection: MutableCollection) { collection.removeIf { it == null } }