marstran
09/20/2018, 2:24 PMlines
and lineSequence
functions: string.lines().joinToString("\n") { it.trim() }
.Hullaballoonatic
09/20/2018, 3:15 PMchromosomes[foo] = bar
(chromosomes
is List<Double>
btw)
gives me this error:
Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
@InlineOnly public inline operator fun <K, V> MutableMap<Int, Double>.set(key: Int, value: Double): Unit defined in kotlin.collections
@InlineOnly public inline operator fun kotlin.text.StringBuilder /* = java.lang.StringBuilder */.set(index: Int, value: Char): Unit defined in kotlin.text
Hullaballoonatic
09/20/2018, 3:16 PMShawn
09/20/2018, 3:21 PMList
rather than a MutableList
Shawn
09/20/2018, 3:22 PMset
or any other mutating methods defined on itHullaballoonatic
09/20/2018, 3:22 PMShawn
09/20/2018, 3:22 PMHullaballoonatic
09/20/2018, 3:23 PMShawn
09/20/2018, 3:23 PMHullaballoonatic
09/20/2018, 3:23 PMpavel
09/20/2018, 3:24 PMpavel
09/20/2018, 3:24 PMShawn
09/20/2018, 3:24 PMlistOf
with more than one element is backed by an arraylistShawn
09/20/2018, 3:24 PMpavel
09/20/2018, 3:24 PMpavel
09/20/2018, 3:24 PMHullaballoonatic
09/20/2018, 3:25 PMShawn
09/20/2018, 3:27 PMval/var
isn’t really about the mutability of objects so much as it is the mutability of referencesShawn
09/20/2018, 3:28 PMlet
will disallow access to mutating methods on a struct and var
will allow itHullaballoonatic
09/20/2018, 3:28 PMHullaballoonatic
09/20/2018, 3:29 PMpavel
09/20/2018, 3:30 PMpavel
09/20/2018, 3:30 PMHullaballoonatic
09/20/2018, 3:30 PMHullaballoonatic
09/20/2018, 3:32 PMHullaballoonatic
09/20/2018, 3:32 PMShawn
09/20/2018, 3:33 PMShawn
09/20/2018, 3:34 PMpavel
09/20/2018, 3:38 PMList
interface declares all modifying methods optional. So you could wrap your favourite List implementation and make all the modifying methods you don’t like throw UnsupportedOperationException
pavel
09/20/2018, 3:39 PM