[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...
IntStream과 람다식 응용하기 import java.util.Collections; import java.util.List; import java.util.function.IntPredicate; import java.util.stream.Collectors; import java.util.stream.IntStream; class IntStream_Ex { public static void main(String[] args) { IntStream.range(0, 10).forEach((int value) -> System.out.println(value)); System.out.println(“MAX with Lamda:...
More
최근 댓글