This file contains hidden or 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
print(intList.plus(6)) // will print [1, 3, 4, 6] |
This file contains hidden or 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
print(intList.minus(3)) // will print [1, 4] |
This file contains hidden or 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 personsHashMap: java.util.HashMap<Int, String> = hashMapOf(1 to "Chike", 2 to "John", 3 to "Emeka") | |
personsHashMap.put(4, "Chuka") | |
personsHashMap.remove(2) | |
print(personsHashMap[1]) // will print Chike |
This file contains hidden or 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 postalCodesHashMap: java.util.LinkedHashMap<String, String> = | |
linkedMapOf("NG" to "Nigeria","AU" to "Australia","CA" to "Canada") | |
postalCodesHashMap.put("NA", "Namibia") | |
postalCodesHashMap.remove("AU") | |
postalCodesHashMap.get("CA") // Canada |
This file contains hidden or 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
print(intList.average()) // will print 2.6666666666666665 |
This file contains hidden or 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
package com.chikekotlin.projectx | |
class MyClass |
This file contains hidden or 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
package com.chikekotlin.projectx | |
fun saySomething(): String { | |
return "How far?" | |
} |
This file contains hidden or 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
import com.chikekotlin.projectx.saySomething | |
fun main(args: Array<String>) { | |
saySomething() // will print "How far?" | |
} |
This file contains hidden or 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
import com.chikekotlin.projectx.* |
This file contains hidden or 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
import com.chikekotlin.projectx.saySomething | |
import com.chikekotlin.projecty.saySomething as projectYSaySomething | |
fun main(args: Array<String>) { | |
projectYSaySomething() | |
} |