Travis Griggs
08/25/2021, 10:57 PMval beginEdges: Set<Duration>
get() = emptySet<Duration>() + spans.asSequence().map({ span -> span.begin })
setOf() takes varargs, but I'm not aware of a pythonesque ability to ** an iterable argument to varargs...ephemient
08/26/2021, 12:24 AMspans.mapTo(mutableSetOf()) { span -> span.begin() }
can be used as a Set
, as long as nobody casts it back to a MutableSet
ephemient
08/26/2021, 12:25 AMbuildSet { spans.mapTo(this) { span -> span.begin() } }
will create a Set that will throw on mutationephemient
08/26/2021, 12:27 AMsetOf(*spans.map { span -> span.begin }.toTypedArray())
but that requires going through an Array twice (due to varargs copying)ephemient
08/26/2021, 12:29 AMfun <T> Sequence<T>.toSet(): Set<T>
extension…