ander.dev
02/04/2018, 10:52 PMander.dev
02/04/2018, 10:52 PMander.dev
02/04/2018, 11:56 PModay
02/05/2018, 9:37 AModay
02/05/2018, 9:37 AModay
02/05/2018, 9:37 AModay
02/05/2018, 9:38 AMdiesieben07
02/05/2018, 9:38 AMMutableList<T>.sortBy
returns Unit
for me...oday
02/05/2018, 9:39 AMif
oday
02/05/2018, 9:39 AMsearchResults.sortBy {
if (it.negotiated_price != null)
100 - ((it.negotiated_price.toInt() / it.price) *
100)
}
oday
02/05/2018, 9:39 AMif
and rely on ?.
it’s fineoday
02/05/2018, 9:40 AMdiesieben07
02/05/2018, 9:40 AMelse
blockoday
02/05/2018, 9:40 AMthis
?oday
02/05/2018, 9:40 AModay
02/05/2018, 9:41 AMit
diesieben07
02/05/2018, 9:41 AMdiesieben07
02/05/2018, 9:41 AMsortBy
lambda, otherwise the sorting does not really make sense does it?oday
02/05/2018, 9:41 AMchintanshah
02/05/2018, 4:41 PMchintanshah
02/05/2018, 4:41 PMkarelpeeters
02/05/2018, 4:43 PMDuring an instance initialization, the initializer blocks are executed in the same order as they appear in the class body, interleaved with the property initializers:
karelpeeters
02/05/2018, 4:44 PMkarelpeeters
02/05/2018, 4:44 PMFirst, default constructor arguments are evaluated, starting with argument to the constructor you call directly, followed by arguments to any delegated constructors. Next, initializers (property initializers and init blocks) are executed in the order that they are defined in the class, top-to-bottom. Finally, constructors are executed, starting with the primary constructor and moving outward through delegated constructors until the constructor that you called is executed. The constructor order is probably the most surprising, since no matter where in the class the constructor is defined, it is always executed after all initializers have run.
karelpeeters
02/05/2018, 4:45 PMibcoleman
02/05/2018, 8:18 PMilya.gorbunov
02/05/2018, 8:22 PMa.groupingBy { it.first }.fold(0) { acc, pair -> acc + pair.second }.toList()
kristofdho
02/06/2018, 1:42 PMlocke
02/06/2018, 5:01 PMfoo()
, and a method that accepts an instance of that interface. Is it possible to pass a lambda satisfying foo()
to that method parameter?locke
02/06/2018, 5:01 PM