If you aren't going to delete the ListOf in this change, you probably should keep this logic (slightly updated to compare the type in ListOf with the type from the List<T> is present).