Skip to content

Instantly share code, notes, and snippets.

View sajjadyousefnia's full-sized avatar
🤒
Out sick

Sajjad Yousefnia sajjadyousefnia

🤒
Out sick
View GitHub Profile
print(intList.plus(6)) // will print [1, 3, 4, 6]
print(intList.minus(3)) // will print [1, 4]
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
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
print(intList.average()) // will print 2.6666666666666665
package com.chikekotlin.projectx
class MyClass
package com.chikekotlin.projectx
fun saySomething(): String {
return "How far?"
}
import com.chikekotlin.projectx.saySomething
fun main(args: Array<String>) {
saySomething() // will print "How far?"
}
import com.chikekotlin.projectx.*
import com.chikekotlin.projectx.saySomething
import com.chikekotlin.projecty.saySomething as projectYSaySomething
fun main(args: Array<String>) {
projectYSaySomething()
}