Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavaOptional patternsSingle-choice MCQ

Why is using Optional.ofNullable(map.get(key)).orElse(computeExpensive()) considered a subtle anti-pattern compared to using orElseGet?

Optional.ofNullable(cache.get(key)).orElse(computeExpensive());