Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .gradle/7.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/7.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/7.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/7.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
fun main(args: Array<String>) {

// ----------------------------------------------------------------- //
// HomeWork Part 1 //
val mapOfCountries = mutableMapOf("SA" to "Saudi Arabia", "US" to "United State", "CAN" to "Canada") // create a map
mapOfCountries.putAll(setOf("UK" to "United Kingdom", "JA" to "Japan")) // add sets of data to map
mapOfCountries.replace("UK", "Uk") // replace value to be UK
mapOfCountries.remove("JA") // remove the key JA with its value
println(mapOfCountries) // print the map
println("------------------------------------------------------")

// your code here


// ----------------------------------------------------------------- //
// HomeWork Part 2 //

val mapOfPhones = mapOf(1 to "Samsung", 2 to "Apple", 3 to "Huawei").toMutableMap() // create a map
mapOfPhones.putAll(listOf("HTC", "Nokia", "Sony").mapIndexed { index,item -> index+4 to item }) // add list to map
println(mapOfPhones) // print the map

}