본문
삼항연산자
프로그래밍/Java 2016. 12. 28. 10:53
# 삼항연산자
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | public void method01() { Map<String, Object> condition = new HashMap<String, Object>(); String value = "stringValue"; condition.put("tureOrFalse", true); condition.put("valueTest", value); method02(condition); } public void method02(Map<String, Object> condition) { Boolean tureOrFalse = condition.get("tureOrFalse") == null ? false : (Boolean) condition.get("tureOrFalse"); String valueTest = condition.get("valueTest") == null ? "" : (String) condition.get("valueTest"); // ... } | cs |
댓글