Optional.ofNullable(noteLst) .orElseGet(Collections::emptyList) // creates empty immutable list: [] in case noteLst is null .stream().filter(Objects::nonNull) //loop throgh each object and consider non null objects .map(note -> Notes::getTagName) // method reference, consider only tag name .forEach(System.out::println); // it will print tag names