File tree Expand file tree Collapse file tree 11 files changed +15
-15
lines changed Expand file tree Collapse file tree 11 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ title: Null Safety
33---
44
55
6- In an effort to rid the world of ` NullPointerException ` , variable types in Kotlin don't allow the assigment of ` null ` .
6+ In an effort to rid the world of ` NullPointerException ` , variable types in Kotlin don't allow the assignment of ` null ` .
77
88<div class =" sample " markdown =" 1 " >
99
@@ -27,7 +27,7 @@ fun main(args: Array<String>) {
27271 . Declare a non-null String variable
28282 . Declare a nullable String variable
29293 . Set the nullable variable to null
30- 4 . When infering types, the compiler assumes non-null for variables that are initialized with a value
30+ 4 . When inferring types, the compiler assumes non-null for variables that are initialized with a value
3131
3232### Working with nulls
3333
Original file line number Diff line number Diff line change @@ -56,6 +56,6 @@ fun main(args: Array<String>) {
56564 . Increment step for char ranges are also valid
57575 . To create a range in _ reverse_ order use ` downTo() ` function
58586 . Ranges are also useful in ` if ` statements
59- 7 . ` !in ` is oposite of ` in ` . Statement is equal to ` _false_ `
59+ 7 . ` !in ` is opposite of ` in ` . Statement is equal to ` _false_ `
6060
6161
Original file line number Diff line number Diff line change 11# Null Safety
22
3- In an effort to rid the world of ` NullPointerException ` , variable types in Kotlin don't allow the assigment of ` null ` .
3+ In an effort to rid the world of ` NullPointerException ` , variable types in Kotlin don't allow the assignment of ` null ` .
44
55<div class =" language-kotlin " theme =" idea " data-min-compiler-version =" 1.3 " >
66
@@ -28,7 +28,7 @@ fun main() {
28282 . Trying to assign ` null ` to non-nullable variable produces a compilation error.
29293 . Declare a nullable String variable.
30304 . Set the nullable variable to ` null ` .
31- 5 . When infering types, the compiler assumes non-` null ` for variables that are initialized with a value.
31+ 5 . When inferring types, the compiler assumes non-` null ` for variables that are initialized with a value.
3232
3333## Working with nulls
3434
Original file line number Diff line number Diff line change @@ -52,5 +52,5 @@ fun main() {
52524 . Increment step for char ranges are also valid
53535 . To create a range in _ reverse_ order use ` downTo() ` function
54546 . Ranges are also useful in ` if ` statements
55- 7 . ` !in ` is oposite of ` in ` . Statement is equal to ` _false_ `
55+ 7 . ` !in ` is opposite of ` in ` . Statement is equal to ` _false_ `
5656
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ fun main() {
39392 . Auto-generated ` equals ` makes data classes with equal information equals as well.
40403 . Equal data classes have equal ` hashCode() ` .
41414 . Predefined ` copy ` function makes it easy to obtain a new instance.
42- 5 . Property values can be changed on copy. The order corresponds to contructor argument order.
42+ 5 . Property values can be changed on copy. The order corresponds to constructor argument order.
43436 . It is possible to change only some values.
44447 . Use named arguments to change the second value without altering the first one.
45458 . Additionally special ` componentN ` functions are generated.
Original file line number Diff line number Diff line change 11# filter
22
3- * filter* is a function defined in the standard library that can be used to filter collection. It takes a predicate as an lambda-paramters .
3+ * filter* is a function defined in the standard library that can be used to filter collection. It takes a predicate as an lambda-parameters .
44
55<div class =" language-kotlin " theme =" idea " data-min-compiler-version =" 1.3 " >
66
@@ -16,8 +16,8 @@ fun main() {
1616// sampleEnd
1717
1818 println (" Numbers: $numbers " )
19- println (" Positive Numbers: positives" )
20- println (" Negative Numbers: negatives" )
19+ println (" Positive Numbers: $ positives" )
20+ println (" Negative Numbers: $ negatives" )
2121}
2222```
2323
Original file line number Diff line number Diff line change 11# map
22
3- * map* is an extension function defined in the standard library that can be used to transform collection into another collection. It takes a transformer as an lambda-paramters .
3+ * map* is an extension function defined in the standard library that can be used to transform collection into another collection. It takes a transformer as an lambda-parameters .
44
55<div class =" language-kotlin " theme =" idea " data-min-compiler-version =" 1.3 " >
66
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ fun main() {
7979 val allLess6 = numbers.none { it > 6 } // 3
8080// sampleEnd
8181
82- println (" Numbers: numbers" )
82+ println (" Numbers: $ numbers" )
8383 println (" All numbers are even: $allEven " )
8484 println (" No element greater than 6: $allLess6 " )
8585}
Original file line number Diff line number Diff line change @@ -27,4 +27,4 @@ fun main() {
27271 . Define collection of different words.
28282 . Looking for the first word starting with "some".
29293 . Looking for the last word starting with "some".
30- 4 . Lookign for the first word containing "nothing".
30+ 4 . Looking for the first word containing "nothing".
Original file line number Diff line number Diff line change @@ -24,4 +24,4 @@ fun main() {
2424
25251 . Define two collections.
26262 . Zip them into pairs using infix notation.
27- 3 . Zip them concatinating together.
27+ 3 . Zip them concatenating together.
You can’t perform that action at this time.
0 commit comments