Davide Giuseppe Farella
02/03/2019, 8:55 PMDavide Giuseppe Farella
02/03/2019, 8:56 PMchildNodeBlock
?, something like private fun <T> Node.childNodeBlock( block: (child: Node) -> T ) = block(this )
Andrew Gazelka
02/04/2019, 4:35 AMFile
but not Path
Andrew Gazelka
02/04/2019, 5:20 AMBernhard
02/04/2019, 8:56 AMBernhard
02/04/2019, 8:56 AMHullaballoonatic
04/17/2019, 8:03 PMHawk
04/17/2019, 9:58 PMJoe
04/18/2019, 6:25 PMdata class TableColumn<T,U>(val rawColumn: T, val transformer: (U) ->T)
Is it possible to add a secondary constructor that forces both type parameters to be the same? something like:
data class TableColumn<T,U>(val rawColumn: T, val transformer: (U) ->T) {
constructor(rawColumn: <**U==T**>): this(rawColumn, { it })
}
basically I want to be able to create a TableColumn<T,T>
instance by only specifying a single T instance and have the transformer "automatically" do an identity transform.tenprint
04/18/2019, 7:42 PM[java -- sorry]
public static Dialog showDialog(
Context context,
OnButtonClickListener onOk,
OnButtonClickListener onCancel) { ...}
This syntax compiles:
fun foo() {
Dialogs.showDialog(activity,
{ dialog, button ->
viewModel.doSomething()
dialog.dismiss()
},
{ dialog, button -> dialog.dismiss() }
)
}
However when I try to pass onCancel
as a parameter, it doesn’t compile. Error on second paramter below.
fun foo(onCancel: OnButtonClickListener) {
Dialogs.showDialog(activity,
{ dialog, button ->
viewModel.doSomething()
dialog.dismiss()
}, <-- Type mismatch: inferred type is (???, ???) -> [ERROR: <ERROR FUNCTION RETURN TYPE>] but OnButtonClickListener was expected
onCancel
)
}
What am I doing wrong?
Thankstenprint
04/18/2019, 7:43 PMSmallville7123
04/19/2019, 4:03 PMSmallville7123
04/19/2019, 4:36 PMSmallville7123
04/19/2019, 4:40 PMmorcerfdumas
04/20/2019, 7:50 AMSerializable
, and sending one of it’s sub-classes as intent extra to the next activity. However, in the 2nd activity, pattern matching fails because the serialized object obtained from the intent extras is not the same as the classes in the when
classesmorcerfdumas
04/20/2019, 7:50 AMkarelpeeters
04/20/2019, 7:52 AMhashcode
and equals
properly.ghedeon
04/21/2019, 7:52 PMBreadMoirai
04/23/2019, 8:13 PMSrSouza
04/24/2019, 1:16 AMrustyrazorblade
04/25/2019, 1:47 AMrustyrazorblade
04/25/2019, 1:52 AMrustyrazorblade
04/25/2019, 2:20 AMvach
04/25/2019, 8:57 AMthana
04/25/2019, 9:02 AMuser
04/25/2019, 7:26 PMcrummy
04/28/2019, 4:25 AMvar UByte.upperNibble get() = (this.toInt() shr 4 and 0b1111).toUByte()
set(value) {
assert(value <= 0xFFu)
this = (value.toUInt() shr 4) + this.lowerNibble // this line doesn't work; "variable expected"
}
karelpeeters
04/28/2019, 8:42 AMthis =
.