I have following code:
final Optional<List<ServiceAttributeValue>> attributeValueList = Optional.<Product> of(product)
.map(Product::getServiceAttributes)
.map(ServiceAttributeMap::getMap)
.map((v) -> (ServiceAttribute) v.get(attributeV.getAttributeString()))
.map((c) -> (List<ServiceAttributeValue>) c.getValueList());
do I need to add check if v is null?
.<Product>and you don't need the prentheses around single argument lambdas (you can replace(v) ->withv ->).