Using Java Optional:
List<String> myList = .... Optional.ofNullable(myList) .ifPresentOrElse(.. do something.., ()-> log.error("missing list")); I do want to catch in logs when the list is null or empty. The above works perfectly for null. How can it be extended to catch the empty collections?
streamin this example?myList == null || myList.isEmpty()?