Set keys = geck_id.keySet(); // The set of keys in the map. Iterator keyIter = keys.iterator(); Object key = keyIter.next(); // Get the next key. Collection col = (Collection)geck_id.get(key); // Get the value for that key. Iterator i = col.iterator(); System.out.println( " (" + key + "," + (i.hasNext() ? i.next() : null)+ ")" ); String geckid = new String (key + "-" + (i.hasNext() ? i.next() : null));