Tomasz Krakowiak
10/31/2020, 3:51 PMIaroslav Postovalov
10/31/2020, 5:06 PMcontract
in this function correct?Twferrell
11/01/2020, 12:50 AMPablo
11/01/2020, 8:53 AMANIMAL:TYPE:{variable1};NAME:{variable2};AGE:{variable3};FAMILY:{variable4};
Note, perhaps variable4
is null/empty and I have anything there, I mean I should be able to replace with "" if it's not presentCaio Costa
11/01/2020, 2:59 PMSlackbot
11/01/2020, 3:10 PMbjonnh
11/02/2020, 3:07 AMBen Hammond
11/02/2020, 10:59 AMBen Hammond
11/02/2020, 11:00 AMEdoardo Luppi
11/02/2020, 12:31 PMAlex
11/02/2020, 1:53 PM@file:DependsOn("...")
annotation on it and it should work, I'm getting an error that "DependsOn" doesn't existLilly
11/02/2020, 4:59 PMarrayOf(
Libraries.APPCOMPAT,
*Libraries.KotlinExt.getAll(),
Libraries.TIMBER
).forEach { // do sth. }
getAll()
returns an array but could als be another type of collection, I'm flexible here. What would be an idomatic solution?Anthony Dahanne
11/02/2020, 5:27 PMDmitry Romanov [JB]
11/02/2020, 6:18 PMchristophsturm
11/02/2020, 7:01 PMclass A class B class C
(i learned that by a copy paste mistake)robstoll
11/02/2020, 8:11 PMLeon K
11/02/2020, 11:54 PMkvs
11/03/2020, 4:55 AMBart
11/03/2020, 7:35 AM/**
* Asserts that two objects of type [T] are equal.
*/
infix fun <T> T.shouldBe(that: T) {
Assertions.assertEquals(that, this)
}
So that I can easily write data.property shouldBe value
, this works great.
But when I supply two values of different types "string" shouldBe 5
, the compiler doesn't complain. It infers the generic type to be Any
.
While valid behaviour, it's not what I want to happen. Is there a way I can tell Kotlin to not upcast the generic type if the argument type is not assignable to the receiver type?mplain
11/03/2020, 10:47 AMcontentType(MediaType contentType)
In my Kotlin code I call that method, passing a null
Intellij IDEA Ultimate 2020.2 highlights it in red, saying:
Null cannot be a value of a non-null type MediaType
But there are no special annotations on the interface method
Why does this happen, and how do I handle it?
(I actually pass a nullable value, and the DefaultWebClient implementation calls a method annotated with @Nullable, so it can work with nulls)tim
11/03/2020, 10:53 AMval list = listOf(2,3,4)
val el = 1
val next = listOf(el) + list
Thoughts?df
11/03/2020, 2:48 PMval foo = doSomething();
if (!foo) return;
and
val foo = doSomething() ?? return
would be nice.Bernhard
11/03/2020, 3:46 PMsequence.flatMap { list.asSequence }
sequence.flatMap { list }
is enoughSerhii K
11/03/2020, 6:02 PMJason5lee
11/04/2020, 2:33 AMJvmName
for the extension method of UInt
.
It works for Int
.Shreyas Patil
11/04/2020, 8:06 AMAdalPari
11/04/2020, 9:07 AMpublic interface ThreadExecutor {
void execute(Runnable runnable);
}
Which I can call from Kotlin this way:
threadExecutor.execute { //code }
But, If I convert the interface to Kotlin, then I get an error in those calls, saying that they expect a Runnable but the return is Unit.
interface ThreadExecutor {
fun execute(runnable: Runnable)
}
And I have to explicitly create the Runnable object.
threadExecutor.execute(Runnable { /* Code */ })
Would be great to understand why it happens, but also any idea on how to better solve it without having to create the Runnable in every call?ribesg
11/04/2020, 1:54 PMimport Scratch_12.MyUITableViewCell.Companion.register
class UITableView
class MyUITableViewCell {
companion object {
fun UITableView.register() {}
}
}
val tableView = UITableView()
with(tableView) {
MyUITableViewCell.register()
}
The IDE adds the import but the call to register
is still red and it says it cannot find it and suggests to import it, which does nothing as it’s already imported (example class names are relevant to the use case).bbaldino
11/04/2020, 8:05 PMCountdownLatch
with a value of 1?Ben Butterworth
11/04/2020, 9:20 PMFloatIterator
?, we already have Iterator<Float>
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-float-iterator/