有沒有什麼辦法可以避免這段代碼中的return null
?在java lambda中避免不必要的返回值
@Test
public void testFrontEndPing() throws Exception {
String url = frontEndUrl("ping");
HttpGet httpGet = new HttpGet(url);
httpClient.execute(httpGet, httpResponse -> {
assertEquals(200, httpResponse.getStatusLine().getStatusCode());
return null;
}
);
}
最好的一種解決方案,我知道 - http://bayou.io/release /0.9/javadoc/bayou/util/function/Callable_Void.html – ZhongYu
對你來說,一個採用func'(Response-> void)'的幫助器方法就可以工作。 – ZhongYu
John Rose - http://mail.openjdk.java.net/pipermail/lambda-dev/2013-September/011020.html – ZhongYu