Java tutorial
//package com.java2s; import java.util.List; import java.util.ArrayList; import java.util.Iterator; import java.util.Map; import java.util.Set; public class Main { @SuppressWarnings("rawtypes") public static List<String> keysToList(Map<?, ?> map) { List<String> list = new ArrayList<String>(); Set<?> set = map.entrySet(); Iterator<?> iter = set.iterator(); while (iter.hasNext()) { Map.Entry m = (Map.Entry) iter.next(); list.add("" + m.getKey()); } return list; } }