Wednesday, 30 January 2013

HashMap keys and values into ArrayList in java

HashMap hm;
// ...add hm values here...

ArrayList keys = new ArrayList(hm.keySet());
ArrayList values = new ArrayList(hm.values());
ArrayList all = new ArrayList();
all.addAll(hm.keySet());
all.addAll(hm.values());

No comments:

Post a Comment