karelpeeters
11/07/2018, 3:15 PMclass MyMap<K: Any, V: Any>: ConcurrentMap<K, V>
and all would be fine.miha-x64
11/14/2018, 10:31 PMCollections.unmodifiableLias(Arrays.asList(...))
with a single one?diego-gomez-olvera
11/15/2018, 12:30 PMList.of(..)
, if not you can make it based on its implementation https://github.com/netroby/jdk9-dev/blob/master/jdk/src/java.base/share/classes/java/util/ImmutableCollections.javaDominaezzz
11/18/2018, 5:52 PMelements
is empty? https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/contains-all.html#containsallkarelpeeters
11/18/2018, 5:52 PMkarelpeeters
11/18/2018, 5:56 PMkioba
12/02/2018, 3:12 PMarrayOf("A", "B").filter{}
returns List<String>
instead of an Array<String>
Should we have an implementation of filter on higher kind type to be able to return the same container?karelpeeters
12/02/2018, 3:15 PMkioba
12/02/2018, 3:35 PMmiha-x64
12/03/2018, 12:23 PMArray<T>.mapToArray
extension, but filter
, of course, is not the case.Daniel Rust
12/10/2018, 5:42 PMkarelpeeters
12/10/2018, 5:43 PMlist.joinToString { it.foo }
karelpeeters
12/10/2018, 5:43 PMlist.map { it.foo }
?Daniel Rust
12/10/2018, 5:45 PMMike
12/10/2018, 8:42 PMMarc Knaup
12/13/2018, 7:03 PMIntRange
and ComparableRange<Int>
with same start
and endInclusive
aren't equal?
From the outside they're both ClosedRange<Int>
.
val a: ClosedRange<Int> = 1 .. 2
val b: ClosedRange<Int> = ((1 as Comparable<Any>) .. (2 as Comparable<Any>)) as ClosedRange<Int>
println(a == b) // false
cbruegg
12/13/2018, 7:32 PMShawn
12/17/2018, 2:46 PMmapIndexed
, but that might not exactly be the best routeDias
12/17/2018, 2:46 PMShawn
12/17/2018, 2:46 PMdave08
01/01/2019, 5:45 PMrunCatching<SpecificException> { }
version somehow... or/and onFailure<SpecificException> { e: SpecificException }
I find myself with extra boilerplate (and nesting) `if`s or `when`s in those blocks when I'm only expecting a certain range of Exception types and they need different treatment (and others need to actually be thrown, so I need to call getOrThrow()
at the end just to rethrow those other exceptions even when I don't need the result...karelpeeters
01/01/2019, 6:49 PMdave08
01/02/2019, 11:25 AMrunCatching { code() }
.onFailure {
if (it is DomainException) handleDomainError(it)
}.getOrThrow() // To throw other errors that are not domain related, if there are.
// This might be much better
runCatching { code() }
.onFailure<DomainException> { handleDomainError(it) }
.onFailure<DomainException2> { handleOtherDomainError(it) }
// If there's another error it throws here without using getOrThrow()
// this is like having multiple 'catch's in a try/catch, and is easier to compose and use with lists of results... also there's no nesting.
@karelpeetersnatpryce
01/07/2019, 3:01 PMnatpryce
01/07/2019, 3:01 PMdiesieben07
01/07/2019, 3:01 PMkotlin.random.Random
is a separate API, which is available also outside the JVM.natpryce
01/07/2019, 3:02 PMdiesieben07
01/07/2019, 3:02 PMasJavaRandom
and asKotlinRandom
to convert between the two.natpryce
01/07/2019, 3:03 PMnatpryce
01/07/2019, 3:03 PM