how to convert map to list in java?

2.95K viewsJava
0

Best way to convert Map values to List in Java, please suggest to me.

Changed status to publish
Add a Comment
0

Use below snippet code, it will work fine, try and let us know.

 

//here am creating map values and putting some values
Map<String, String> map= new HashMap<String, String>();
map.put("P", "Programming");
map.put("B", "Business");
map.put("T", "Technology");

//here am iterating the map and putting in to list
List<String> listVal = new ArrayList(map.values());

 

Changed status to publish
Add a Comment
You are viewing 1 out of 2 answers, click here to view all answers.
Write your answer.