damian
12/22/2015, 8:37 PMIterable<T>
has sumBy
(Int
) and sumByDouble
, but no sumByFloat
. These seem like odd omissionsevanchooly
12/22/2015, 8:53 PMdamian
12/22/2015, 8:59 PMkirillrakhman
12/22/2015, 9:06 PMgetRaw
now deprecated?ilya.gorbunov
12/22/2015, 9:45 PMget
can be used instead in the most cases, and get
with casting parameter to Any in the rest.apatrida
12/23/2015, 3:36 PMwith
has changed? was in all previous versions (BETA 4 and before):
public inline fun <T> T.with(initWith: T.() -> Unit): T { … }
now in SNAPSHOT is:
public inline fun <T, R> with(receiver: T, f: (T) -> R): R { … }
EDIT, is my bad, repackaging of things changed what was imported at the moment when using SNAPSHOT vs. BETA 4ilya.gorbunov
12/23/2015, 3:42 PMwith
function signature haven't been changed for more than a year, you can check our sources: https://github.com/JetBrains/kotlin/blame/beta4/libraries/stdlib/src/kotlin/util/Standard.kt#L37apatrida
12/23/2015, 3:43 PMilya.gorbunov
12/23/2015, 3:43 PMapatrida
12/23/2015, 3:44 PMilya.gorbunov
12/23/2015, 3:45 PMkotlin
packageapatrida
12/23/2015, 3:45 PMapatrida
12/23/2015, 3:46 PMapatrida
12/23/2015, 3:48 PMapatrida
12/23/2015, 3:48 PMwith
top level and T.with
be able to coexist? @ilya.gorbunovapatrida
12/23/2015, 3:57 PMmichaelrocks
12/25/2015, 3:43 PMpublic fun <T : Any> Iterable<T?>.requireNoNulls(): Iterable<T> {
for (element in this) {
if (element == null) {
throw IllegalArgumentException("null element found in $this.")
}
}
return this as Iterable<T>
}
As far as I understand after invoking this method the iterable may become empty.mplatvoet
12/25/2015, 3:52 PMcedric
12/25/2015, 4:21 PMjw
12/25/2015, 5:35 PMjw
12/25/2015, 5:36 PMthis
is Iteratable<T?>
orangy
List<T>
instead and make a snapshot, like all other functions on Iterable
, e.g. filterNotNull
orangy
Sequence
should be lazy of course. /cc @ilya.gorbunovcedric
12/25/2015, 7:41 PMList
?orangy
orangy
asSequence()
mplatvoet
12/25/2015, 8:03 PMpublic fun <T : Any, S : Iterable<T?>, R : Iterable<T>> S.requireNoNulls(): R
cedric
12/25/2015, 8:14 PMCanBuildFrom
which Scala is still trying to recover from today. Really not worth it, agree with @orangycedric
12/25/2015, 8:15 PMList
is fine)mplatvoet
12/25/2015, 8:16 PM