Method reference of a method reference in a Lambda expression

Sandro Rey :

I am new in Java 8, and I have this expression:

 .map(mc -> mc.getName().getDefaultName())

and I would like to know if it could be replaced for something like:

.map(TeleBadalonaCampaignType::getName::getDefaultName)
Eugene :

nope, not really - the language has no such construct; unless you map it twice:

.map(TeleBadalonaCampaignType::getName)
.map(WhateverObject::getDefaultName)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=120975&siteId=1