I was writing a small piece of code in which I internally handle my data in a mutable map, which in turn has mutable lists.
I wanted to expose my data to the API use
Use Collections to converts a Mutable list to Immutable list, Example:
Mutable list:
val mutableList = mutableListOf()
Converts to Immutable list:
val immutableList = Collections.unmodifiableList(mutableList)