2011년 9월 25일 일요일

JAVA코딩테크닉_for를 for each 처럼 쓰기

List<Object> rtn = workDAO.getAttendList(map);
HashMap<String, Object> hm;
DecimalFormat df = new DecimalFormat("####0.00");

for (Iterator<Object> i = rtn.iterator();i.hasNext();)
{//.25에 0붙여 주기
hm = (HashMap<String, Object>)i.next();

hm.put("COL1", df.format(hm.get("COL1").toString()));
hm.put("COL2", df.format(hm.get("COL2").toString()));
hm.put("COL3", df.format(hm.get("COL3").toString()));
}

System.out.println(rtn);

return rtn;

댓글 없음:

댓글 쓰기