Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.
Date: 2015jan3 Language: java Q. How can I convert a HashMap into an ArrayList? A. If you have:HashMap<String,Integer> h = new HashMap<String,Integer>();To convert the keys into an ArrayList:ArrayList<String> a = new ArrayList<String>(h.keySet());To convert the values into an ArrayList:ArrayList<Integer> a = new ArrayList<Integer>(h.values());
Add a commentSign in to add a comment