[JAVA8] Optional 활용
Optional.ofNullable(melonDjM.informGnrTag(params)).ifPresent(value ->{ result.put(“key”,value.get(“key”); }).orElse(result.put(“key”, “”));
황트루치
Optional.ofNullable(melonDjM.informGnrTag(params)).ifPresent(value ->{ result.put(“key”,value.get(“key”); }).orElse(result.put(“key”, “”));
Optional 클래스의 ifPresent 함수 사용하여 고급지게 null체크하기 import com.google.gson.JsonObject; import java.util.Optional; class Car{ String speed; String name; public String getSpeed() { return speed; } public void setSpeed(String speed) { this.speed...
More
최근 댓글