CCMT c = new CCMT();
c.ccd = null;
Optional<String> cType = Optional.ofNullable(ccmtRequest).map(CCMT::getCcd).map(MOEH::getDestCtry);
System.out.println(cType.isPresent()); // false
if(cType.isPresent() && cType.get().equalsIgnoreCase("CCMT") || cType.get().equalsIgnoreCase("CCWC")) {
System.out.println("wfegr");
}
ERROR: Exception NoSuchElementException
Why cType.get() statement is being executed even though first condition is false itself?