This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bindsym $mod+0 mode "$mode_system" | |
set $mode_system (l)ock, (e)xit, switch_(u)ser, (s)uspend, (h)ibernate, (r)eboot, (Shift+s)hutdown | |
mode "$mode_system" { | |
bindsym l exec --no-startup-id i3exit lock, mode "default" | |
bindsym s exec --no-startup-id i3exit suspend, mode "default" | |
bindsym u exec --no-startup-id i3exit switch_user, mode "default" | |
bindsym e exec --no-startup-id i3exit logout, mode "default" | |
bindsym h exec --no-startup-id i3exit hibernate, mode "default" | |
bindsym r exec --no-startup-id i3exit reboot, mode "default" | |
bindsym Shift+s exec --no-startup-id i3exit shutdown, mode "default" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exec --no-startup-id start-pulseaudio-x11 | |
exec --no-startup-id pa-applet | |
bindsym $mod+Ctrl+m exec pavucontrol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class MyData(var value: String) | |
fun main() { | |
var mutable = MyData("Foo") | |
val immutable = MyData("Bar") | |
mutable = immutable // This is fine | |
immutable = mutable // This will not compile | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Space{ | |
var squares = 24 | |
var triangles = 23 | |
val all: Int | |
get() { | |
return squares + triangles | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val space = Space() | |
println(space.all) // result 47 | |
val squares = 30 | |
space.squares = squares * 2 | |
println(space.all) // result 84 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed class MyValue(default: String) { | |
open val value: String = default | |
class Immutable(default: String): MyValue(default) { | |
fun mutate(): Mutable = Mutable(value) | |
} | |
class Mutable(default: String) : MyValue(default) { | |
fun immutate(): Immutable = Immutable(value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val mutable = MyValue.Mutable("Foo") | |
val immutable = MyValue.Immutable("Foo") | |
mutable.value = "Bar" // This is fine | |
immutable.value = "Bar" // This will not compile because value cannot be reassigned | |
val mutated = immutable.mutate() | |
mutated.value = "Bar" // This is fine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyOtherValue(default: String) { | |
lateinit var value: String | |
private set | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val myOtherValue = MyOtherValue("Foo") | |
myOtherValue.value = "Bar" // This will not compile because value cannot be reassigned |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MutableObj { | |
var value = "" | |
override fun toString(): String { | |
return "MutableObj(value='$value')" | |
} | |
} | |
fun main() { | |
val mutableObj:MutableObj = MutableObj()//(1) |
OlderNewer