is there a way to use the reified type parameters ...
# getting-started
m
is there a way to use the reified type parameters with generic Collections like so:
Copy code
private inline fun <reified T> Collection<T>.toSearchResultItems(): List<SearchResultItem> = when (T::class) {
        is BaseRequestBUData ->
            // T should be BaseRequestBUData, thus this should be Collection<BaseRequestBUData>
            this.map {
                SearchResultItem(
                    id = it.id,
                    firstname = it.vorname,
                    lastname = it.nachname,
                    createdAt = DateTime.now(),
                    type = Type.BU
                )
            }
        is Kundendaten -> this.map { kundendatenAssembler.assembleResource(it) }
        else -> throw IllegalArgumentException("type cannot be converted")
    }