dmitry.petrov
03/16/2017, 2:35 PMokaymak
03/16/2017, 2:38 PM( . )( . )
mg6maciej
03/16/2017, 2:39 PMkirillrakhman
03/17/2017, 6:49 PMvar beforeFrame: View? = null
var beforeImg: ImageView? = null
var afterFrame: View? = null
var afterImg: ImageView? = null
val v = linearLayout {
layoutParams = ViewGroup.LayoutParams(wrapContent, matchParent)
beforeFrame =
frameLayout {
beforeImg =
imageView {
}
}.lparams()
afterFrame =
frameLayout {
afterImg =
imageView {
}
}.lparams()
}
return PairedPhotoPreviewHolder(v, beforeFrame!!, beforeImg!!, afterFrame!!, afterImg!!)
okaymak
03/18/2017, 9:25 PMbenleggiero
03/21/2017, 12:11 AMbeholder
03/21/2017, 5:05 PMKProperty
, but just String
for property name?miha-x64
03/21/2017, 7:53 PMbenleggiero
03/21/2017, 11:45 PM-
a part of number literals, so that calls like -1L.dec()
are the same as (-1L).dec()
instead of -(1L.dec())
benleggiero
03/22/2017, 12:53 AMrrader
03/24/2017, 2:08 PMmg6maciej
03/24/2017, 7:23 PMmg6maciej
03/24/2017, 7:25 PMtypealias UserId = String
class User(val id: UserId)
val myString: String = "blabla"
User(myString) // wouldn't compile
johnl
03/25/2017, 10:49 AMelect
03/26/2017, 8:29 PMforEachIndexed
offering immediately i, it
dmitry.petrov
03/27/2017, 6:18 AMdmitry.petrov
03/27/2017, 11:05 AMlouiscad
03/27/2017, 3:45 PMobject
declared in an object
) extending an inner class
of a superclass of the enclosing object, the compiler fails when you do this. I had to replace my inner class
with a constructor property instead, while the extended inner class would have made it implicit, allowing me to strip the extra val constructor parametercedric
03/27/2017, 5:21 PMnew
on a type parameter, but I’ve always found it unnecessary since you can just as well pass a lambda factory method.johnl
03/28/2017, 11:41 AMlouiscad
03/28/2017, 12:45 PMcheck(…)
and require(…)
stdlib methods. What do you think?benleggiero
03/28/2017, 1:10 PMmg6maciej
04/01/2017, 8:40 PM!in
-> is not in
.mbstavola
04/05/2017, 5:08 PMdean
04/11/2017, 4:24 AMarr
, and because we know the width and height are fixed to 2 and 4, we can make it a 1D array of length 8.dmitry.petrov
04/12/2017, 8:15 AMcbruegg
04/12/2017, 11:26 AMbenleggiero
04/17/2017, 11:45 PMnimtiazm
04/19/2017, 2:33 PMnimtiazm
04/19/2017, 2:58 PMconst val list = ArrayList<..>()
and list.add(..) shouldn’t be possiblenimtiazm
04/19/2017, 2:58 PMconst val list = ArrayList<..>()
and list.add(..) shouldn’t be possiblemg6maciej
04/19/2017, 3:06 PMval list: List<...> = ArrayList<..>()
list.add(..)
is not possible.nimtiazm
04/19/2017, 3:09 PMval list = ArrayList<Int>()
println(list.count())
list.add(1)
println(list.count())
mg6maciej
04/19/2017, 3:11 PMval list: List<Int> = ArrayList<Int>()
nimtiazm
04/19/2017, 3:11 PMmg6maciej
04/19/2017, 3:14 PMArrayList
, then you clearly want to mutate it. If you want a list that does not allow mutation, use a List
interface there. You specifically mentioned function arguments in your original proposal. Use List<Int>
as function argument type and you may pass ArrayList<Int>
there. You will not be allowed (unless you cast) to call add
in that function.nimtiazm
04/19/2017, 3:15 PMval
ref, compiler would be able to stop youmg6maciej
04/19/2017, 3:17 PMnimtiazm
04/19/2017, 3:18 PMmg6maciej
04/19/2017, 3:24 PMconst
to arguments have no meaning. Arguments cannot be reassigned and const
has different meaning in language.
const val myConst = 5
will be inlined across the bytecode. That's the meaning of const
.nimtiazm
04/19/2017, 3:28 PMkingsley
04/20/2017, 6:47 AMval list = listOf<Int>()
which solves your problem with type inference and mutability