GarouDan
04/19/2018, 9:56 PMFleshgrinder
04/20/2018, 8:49 AMsealed class A {
fun a() = apply { /* doSomething */ }
}
class B : A() {
fun b() = apply { /* doSomething */ }
}
class C : A() {
fun c() = apply { /* doSomething */ }
}
B().a().b() // cannot call b() now :(
C().a().c() // cannot call c() now :(
fusdahl
04/20/2018, 10:33 AM/
to divide big decimals the outcome is kind of unexpected:
40.toBigDecimal() / 100.toBigDecimal()
0
40.toBigDecimal().divide(100.toBigDecimal())
0.4
This seems to be a result of /
using the half even rounding mode.
Does anyone know why this rounding mode was chosen?Sergio Crespo Toubes
04/20/2018, 10:49 AMadam-mcneilly
04/20/2018, 1:05 PMemptyList()
and ArrayList()
?Michael
04/20/2018, 4:18 PMAndreas Sinz
04/20/2018, 4:27 PMribesg
04/20/2018, 10:07 PMcache.entries.removeAll {
val res = now - it.value.first > duration
if (res) <http://log.info|log.info>("Removing value in cache $name for key ${it.key}")
res
}
Fuyang
04/20/2018, 10:09 PMlist.map { process(it) }
, how can I print out the progress? Using onEach and a counter outside?Dexter
04/21/2018, 1:07 AMAndreas Sinz
04/21/2018, 1:16 PMlielran
04/22/2018, 1:46 PMcom.github.johnrengelman.shadow
but failed to provide the main-class via application
blockJuan
04/22/2018, 7:35 PMif (list is ObservableList<Course>)
? it's displaying this error "Cannot check for instace of erased type: ObservableList<Course>"sujin
04/23/2018, 9:50 AMRoom
? Not the query written in dao but the query generated by room itself.pankajrai
04/23/2018, 12:02 PMdavidarteaga
04/23/2018, 5:14 PMwarriorprincess
04/23/2018, 5:55 PMpavel
04/23/2018, 7:52 PMfoo.if { bar() }
as return foo
if bar()
is truegabrielfv
04/23/2018, 7:57 PMif
or assigning it all to a variable, I just call it like that:
data
.filter { it.hasErrors }
.map { it.error }
.any { it is MyException }
.then { /*Treat that exception*/ }
zpearce
04/23/2018, 8:06 PMdata
.filter { it.hasErrors }
.map { it.error }
.takeIf { it is MyException }
?.let { dealWith(it) }
John
04/23/2018, 8:11 PMkschlesselmann
04/24/2018, 6:02 AMid
and the other using val
somehow? In order to generate equals()
only of id
it has to be the only argument in the primary constructor.
@Entity
data class Term(
@Id
val id: UUID,
val name: String
) {
val definition: Definition = Definition.DEFAULT
constructor(id: UUID, name: String, definition: Definition) : this(id, name) {
this.definition = definition
}
}
I think I'd like to do someting like this …v79
04/24/2018, 8:44 AMtypealias Prefix = String; class Form(request: Request, prefix: String) { constructor(request: Request, postfix: String) : this(request, "") }
(class abbreviated!)Yuriy Kulikov
04/24/2018, 8:53 AMedwardwongtl
04/24/2018, 9:29 AMdata class Response<T>(
...
val data: List<T>
}
Has anyone using moshi to deal with this kind of object? I don't quite seems to find example for doing so..anli
04/24/2018, 9:39 AMlateinit modifier is not allowed on extension properties
error. How to resolve?chirag
04/24/2018, 10:12 AMdata
.mapNotNull {
val type = it.asJsonObjectOrNull()?.get("type")?.asStringOrNull()
val events = it.asJsonObjectOrNull()?.get("events")?.asJsonArrayOrNull()
if (type != null && events != null)
type to events
else
null
}.toMap()
chirag
04/24/2018, 10:13 AMelect
04/24/2018, 10:13 AMArray<Float>
corresponds to Float[]
on Java?karelpeeters
04/24/2018, 10:26 AMkarelpeeters
04/24/2018, 10:26 AMelect
04/24/2018, 10:26 AMkarelpeeters
04/24/2018, 10:27 AMclass Child : Parent
and this function is in Child
. If you have a val child: Child
and a val parent: Parent
only child.foo()
will be inlined but parent.foo()
won't.elect
04/24/2018, 10:29 AM