What is the easiest way to add the keys of a LinkedHashMap to an ArrayList? I would like to increase performance by removing loops. Is there a more efficient way?
for(String key : map.keySet()){
array.add(key);
}
LOG_TAG
20.7k12 gold badges75 silver badges105 bronze badges
asked Jan 9, 2014 at 9:43
1 Answer 1
List array = new ArrayList(map.keySet());
answered Jan 9, 2014 at 9:48
Explore related questions
See similar questions with these tags.
lang-java
array.addAll()
?for
loops, the compiler now a days is very good at optimizing those for you.