for (Object object:myset) {if (object instanceof userInfo)} for (Object key :myMap.keySet()){ System.out.println(key.toString()+""+myMap.get(key))}