voddan
11/12/2016, 5:28 PMslice
functions return listsjw
11/12/2016, 5:29 PMjw
11/12/2016, 5:29 PMvoddan
11/12/2016, 5:29 PMjoin
?voddan
11/12/2016, 5:30 PMString.substring(Iterable)
voddan
11/12/2016, 5:30 PMdimsuz
11/15/2016, 11:42 AMRandom(seed = 777)
will it produce same sequences of values across a process restart? how about across a JVM on different machines? can't google this right away...kirillrakhman
11/15/2016, 1:30 PMdimsuz
11/15/2016, 1:52 PMcleiter
11/15/2016, 4:46 PMRandom
cleiter
11/15/2016, 4:47 PMIf two instances of Random are created with the same seed, and the same sequence of method calls is made for each, they will generate and return identical sequences of numbers. In order to guarantee this property, particular algorithms are specified for the class Random. Java implementations must use all the algorithms shown here for the class Random, for the sake of absolute portability of Java code.
kirillrakhman
11/16/2016, 8:51 AMcoerceAtLeast/AtMost
?voddan
11/16/2016, 10:04 AMcoerceAtLeast
is super useful to limit something, like boo().bar().zuzz().courrceAtLeast(5.0)
voddan
11/16/2016, 10:05 AMmax
is confusingdimsuz
11/16/2016, 12:42 PMit's right in the javadoc of Randomit doesn't state explicitly if this is true for one jvm launch or across launches and even architectures...
ilya.gorbunov
11/16/2016, 2:22 PMminOf
and coerceAtMost
perform the same operation in a nutshell, their usecases are totally different, see @voddan's answerdean
11/21/2016, 4:50 PMjw
11/29/2016, 5:40 AMjw
11/29/2016, 5:41 AMjw
11/29/2016, 5:41 AMMutableList(orig).apply { set(index, get(index).copy(prop = newProp)) }
jw
11/29/2016, 5:44 AMorig.updateIndex(index) { it.copy(prop = newProp) }
or somethinggildor
11/29/2016, 5:51 AMjw
11/29/2016, 5:54 AMjw
11/29/2016, 5:54 AMjw
11/29/2016, 5:55 AMgildor
11/29/2016, 5:55 AMjw
11/29/2016, 5:55 AMgildor
11/29/2016, 6:01 AMrocketraman
11/29/2016, 3:52 PMrocketraman
11/29/2016, 3:53 PMinline fun <T> List<T>.mutate(f: MutableList<T>.() -> Unit): List<T> {
val mutableList = this.toMutableList()
f(mutableList)
return mutableList
}