Erik
09/02/2021, 3:27 PMfun <T> Array<out T>.asList(): List<T>
• fun <T> Array<out T>.toList(): List<T>
By signature, they are identical. So the behaviour must define the naming difference.
Likewise, there exists a fun <T> Array<out T>.asIterable(): Iterable<T>
but not toIterable
.
Then there are all kinds of variants that use names like mapTo
.
When do you use as
, to
, mapTo
or something else?Dominaezzz
09/02/2021, 3:32 PMas
- is just a cheap cast/view.
to
- is a conversion.Erik
09/02/2021, 3:34 PMfun NetworkType.toDatabaseType(): DatabaseType