Reputation: 1143
Is there a way to make ByteArray
unmodifiable in Kotlin?
Like with collections Collections.unmodifiableList(byteList)
Upvotes: 1
Views: 425
Reputation: 97148
A ByteArray
maps to byte[]
when compiled to the JVM, and the JVM has no support for unmodifiable arrays. You can wrap a ByteArray
into a class that holds the array in a property and does not provide any APIs for modifying it.
Upvotes: 3