Hullaballoonatic
06/30/2019, 6:44 AMMaksim Vlasov
06/30/2019, 10:18 AMtschuchort
06/30/2019, 1:32 PMbloder
06/30/2019, 1:47 PMfun handleError(e: Exception) if(e is NetworkException) {}
fun handleError(e: Exception) if(e is WrongUserException) {}
fun handleError(e: Exception) if(e is OtherException) {}
ValV
06/30/2019, 7:47 PMkotlin.jvm.functions.Function0
Siddhartha Juluru
06/30/2019, 10:40 PMJon
06/30/2019, 11:06 PMAntanas A.
07/01/2019, 8:44 AMStephan Schroeder
07/01/2019, 1:45 PMif (prioritizedViews != null) {
prioritizedViews as PrioritizedViews<CareHomeView>
} else ...
in
class CareHomeCombinedView(
private var prioritizedViews: PrioritizedViews<CareHomeView>? = null
) {
private val views: PrioritizedViews<CareHomeView> =
if (prioritizedViews != null) {
prioritizedViews as PrioritizedViews<CareHomeView>
} else {
PrioritizedViews(
)
}
}
class PrioritizedViews<T>(
vararg viewsByPriority: T?
)
interface CareHomeView {}
the type inference normally includes the null-check! What is different this time?
Here the link to the playground: https://pl.kotl.in/js_ASkwV9jdemeulenaere
07/01/2019, 2:30 PMPere Casafont
07/01/2019, 4:43 PMinline operator fun Int?.plus(other: Int?) = if (this != null && other != null) {
this + other
} else {
null
}
Let's say I want to use this in places that are called millions of times per second. Wouldn't the inline
modifier improve performance there as well?xenoterracide
07/01/2019, 4:45 PMvar objectMapper: ObjectMapper = {
val mapper = ObjectMapper()
mapper.registerModules(JavaTimeModule(), KotlinModule())
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)
mapper
}
is there a way to do an initialization block kind of like this? just init
? is there something more per property?Andrew Gazelka
07/02/2019, 4:07 AMJP Wang
07/02/2019, 6:22 AMNir Golan
07/02/2019, 7:43 AMchristophsturm
07/02/2019, 10:27 AMU75957
07/02/2019, 12:20 PMType missmatch
until I write all parameters.victor
07/02/2019, 12:35 PMAdam Hurwitz
07/02/2019, 5:22 PMKrotick
07/02/2019, 5:31 PMinterface Captor<T> {
val captor: CapturingSlot<T>
}
Mockk's class deinition:
class CapturingSlot<T : Any>()
Yet, I am getting Type argument is not within its bounds. Expected: Any. Found: T
Can anyone point me in the right direction?Zach Klippenstein (he/him) [MOD]
07/02/2019, 6:14 PMAndrew Gazelka
07/02/2019, 9:43 PMval people = setOf(personA, personC)
)
json {
"test1" to array(personA, personC) //works
"test2" to array(*people) // does not work
}
interface KlaxonJson {
fun array(vararg args: Any?) : JsonArray<Any?> = JsonArray(args.map { convert(it) })
// ...
qwert_ukg
07/03/2019, 4:09 AMmvn clean install
i have get an error:
[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.31:compile (compile) on project altyn-i-website: Compilation failure: Compilation failure:
[ERROR] ...Service.kt:[6,22] Unresolved reference: Random
But i can run my app from IDEA successfullyJ. Pablo Fernández
07/03/2019, 5:42 AMKulwinder Singh
07/03/2019, 12:37 PMEqualizer
class, so in Equalizer class most of the getters/setters throws
this 4-5 exceptions
. so to access single value i have to add much codeRohan Maity
07/03/2019, 4:43 PMIfvwm
07/04/2019, 6:46 AMarekolek
07/04/2019, 12:24 PMinline fun Foo.notMyFunction(block: Bar.() -> Unit) {
bar.apply(block)
}
inline fun <R> Foo.myFunction(block: (Bar) -> R): R {
notMyFunction {
return let(block)
}
error("")
}
is there any reasonable way to implement myFunction
given notMyFunction
?Nikolay Kasyanov
07/04/2019, 3:05 PMkotlin
fun main(args: Array<String>) {
whatever(-2)
whatever(0)
whatever(2)
}
fun whatever(input: Int) {
if (input < 0) {
"negative"
} else if (input > 0) {
"positive"
} else {
"zero"
}.let {
println(it)
}
}
prints:
zero
positive
LeoColman
07/04/2019, 3:35 PMLeoColman
07/04/2019, 3:35 PMAdam Powell
07/04/2019, 3:37 PMPascalCasing
my enums insteadLeoColman
07/04/2019, 3:38 PMAdam Powell
07/04/2019, 3:44 PMMAX_VALUE
-type things that can be declared with const val
and the official kotlin style guide is kind of vague on thiskarelpeeters
07/04/2019, 5:04 PMLeoColman
07/04/2019, 9:01 PMkarelpeeters
07/04/2019, 9:03 PMLeoColman
07/04/2019, 9:22 PM