Android/Kotlin

[Kotlin] HashMap

lipnus 2018. 11. 24. 19:23
반응형
 
 val hashMap:HashMap<Int,String> = HashMap<Int,String>() //define empty hashmap  
    hashMap.put(1,"Ajay")  
    hashMap.put(3,"Vijay")  
    hashMap.put(4,"Praveen")  
    hashMap.put(2,"Ajay")  
    println(".....traversing hashmap.......")  
    for(key in hashMap.keys){  
        println("Element at key $key = $")  
​

 

 

반응형

'Android > Kotlin' 카테고리의 다른 글

[문법] While문에서 assignment 불가능  (0) 2018.11.25
kotlin기본 문법  (0) 2018.11.25
[Kotlin] Retrofit  (0) 2018.11.24
Glide  (0) 2018.11.24
Button  (0) 2018.11.20