dreamreal
08/18/2017, 11:50 AMdreamreal
08/18/2017, 12:00 PMevanchooly
08/18/2017, 12:26 PMdreamreal
08/18/2017, 12:36 PMdreamreal
08/18/2017, 12:36 PMdreamreal
08/18/2017, 12:38 PMkirillrakhman
08/18/2017, 12:55 PMdreamreal
08/18/2017, 1:11 PMCzar
08/18/2017, 2:02 PMyole
08/18/2017, 2:12 PManosov
08/18/2017, 8:51 PManosov
08/18/2017, 8:58 PMkarelpeeters
08/18/2017, 9:02 PManosov
08/18/2017, 9:02 PMkarelpeeters
08/18/2017, 9:03 PManosov
08/18/2017, 9:05 PMkarelpeeters
08/21/2017, 11:35 AMdiesieben07
08/21/2017, 11:35 AMkarelpeeters
08/21/2017, 9:50 PMkarelpeeters
08/21/2017, 9:51 PMenleur
08/22/2017, 6:13 AMlistOf(1, 2, 3, 4, 5)
.map { n -> n * (n + 1) / 2 }
.mapIndexed { (i, n) -> "Triangular number $i: $n" }
can i inspect map
result?karelpeeters
08/22/2017, 7:34 AM.log()
between those results.gildor
08/22/2017, 7:37 AMenleur
08/22/2017, 7:37 AMgildor
08/22/2017, 7:38 AMgildor
08/22/2017, 7:38 AMkarelpeeters
08/22/2017, 7:38 AMhorse_badorties
08/22/2017, 11:24 AMequals
like this?
class Foo(val name: String) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as Foo
if (name != other.name) return false
return true
}
}
Why not simply using is
?
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is Foo) return false
if (name != other.name) return false
return true
}
Is there a catch?yole
08/22/2017, 11:25 AMequals
needs to be symmetricyole
08/22/2017, 11:26 AMis
, you can have a situation with class Bar : Foo()
where foo == bar
but not bar == foo