Harry Nguyen

Harry Nguyen


Kotlin – Convert Map to/from Properties



In the post, we show how to convert ‘Kotlin Map to Properties’ and versus case ‘Properties to Kotlin Map’.

Read more


What is GEEK

Buddha Community

Kotlin - Convert Map to/from Properties » grokonez


Kotlin – Convert Map to/from Properties

In the post, we show how to convert ‘Kotlin Map to Properties’ and versus case ‘Properties to Kotlin Map’.

I. Kotlin - Convert Map to Properties

Use toProperties() method of Map class, -> Method signature:

fun Map.toProperties(): Properties


package com.javasampleapproach.kotlin.map2properties

fun main(args: Array) {
	val map = mutableMapOf()
	map.put("db.username", "username")
	map.put("db.password", "password")
	map.put("db.driver", "org.postgresql.Driver")
	map.put("db.url", "jdbc:postgresql://localhost/testdb")
	// Converts this [Map] to a [Properties] object.
	// use -> fun Map.toProperties(): Properties
	val propertiesOfMap = map.toProperties()
	// Traverse through propertiesOfMap
	propertiesOfMap.forEach{(k, v) -> println("key=$k, value=$v")}
		key=db.password, value=password
		key=db.url, value=jdbc:postgresql://localhost/testdb
		key=db.username, value=username
		key=db.driver, value=org.postgresql.Driver

II. Kotlin - Convert Properties to Map

Iterate through Properties object by forEach or for-loop statement then manually use put(key: K, value: V) method of Map interface.


More at:


Kotlin – Convert Map to/from Properties

#kotlin #properties #map

Juned Ghanchi


Kotlin App Development Company in India, Hire Kotlin Developers

We are a prime Kotlin app developer in India. We build and provide the best personalized Android apps, migration services, ongoing maintenance, and management.

We have the most efficient Kotlin developers that build ultramodern, interactive, and secure mobile apps. The technologies we use to create the most advanced Kotlin apps are AR/VR, AI/ML, IoT, etc.

Hire Kotlin app developers in India. Meet us, and we will help you meet all of your technology requirements.

#kotlin app development company india #hire kotlin developers india #kotlin app development company #hire kotlin developers #kotlin development agency #kotlin app programmers

Convert Kotlin Map to List » grokonez


Convert Kotlin Map to List

In the tutorial, Grokonez will show you how to convert Kotlin Map to List.

Related posts:

I. Convert Kotlin Map to List

1. Basic Method

- Use public fun Map.toList(): List> to returns a [List] containing all key-value pairs

val simpleMap = hashMapOf("foo" to 1, "bar" to 2)
val pairKeyValueList = simpleMap.toList()
println(pairKeyValueList) // [(bar, 2), (foo, 1)]
  • Use public Collection values() to return a view of the values:

val valueList = simpleMap.values
println(valueList) // [2, 1]
  • Use public Set keySet() to return a set view of the keys:

val keyList = simpleMap.keys
println(keyList) // [bar, foo]

2. Map Object

- When working with Map Object, we can associate with map(transform: (T) -> R) function to customize a returned-list:

More at:


Convert Kotlin Map to List

#kotlin #kotlin-map #kotlin-list

Hire Dedicated Kotlin Developer - WebClues Infotech

The most popular language used for Android app development is Kotlin and recently Kotlin also launched its Cross-Platform app development language Kotlin Multiplatform.

So are you looking to launch a mobile using Kotlin as your Programming Language?

Then you are at the right place as WebClues Infotech offers services to Hire a Dedicated Kotlin Developer who can develop an interactive and rich user-experienced mobile app. Also, WebClues has a flexible pricing model that the business can choose according to its most suitable structure.

So what are you waiting for? Hire a dedicated Kotlin developer from a reputed Web & Mobile app development agency that has successfully served more than 600+ clients.

Get in touch with us!!

Book Free Interview: https://bit.ly/3dDShFg

#hire dedicated kotlin developer #hire dedicated kotlin developer #hire kotlin developers #hire kotlin developer #hire dedicated kotlin app developer #hire kotlin app developers india

How to Develop an Android App with Kotlin?

Do you have an idea to develop an android app using Kotlin?

Are you looking for the best Kotlin app development company in the USA? We at AppClues Infotech offering versatile mobile app development services in the USA. We provide custom mobile app development solutions as per your specific business needs with the prevailing market trending technology & features.

Hire our top-notch Kotlin app designers & developers for your project at a cost-effective price.

Our Kotlin App Development Services:
• Custom Android App Development
• Kotlin AR/VR App Development
• Kotlin App UI/UX Design
• Kotlin App QA & Testing- code Optimization
• Kotlin App Migrations
• Kotlin App Maintenance and Upgrades

For more info:
Website: https://www.appcluesinfotech.com/
Email: info@appcluesinfotech.com
Call: +1-978-309-9910

#kotlin android app development company #best kotlin android app development usa #kotlin android app development #kotlin for android app development #kotlin mobile app development service #create android app with kotlin