[問題] 有這種語法嗎
想請問一下,以下這段是使用JD-GUI解譯出來的其中一段程式碼,
private List<ContentEntityObject> findBlogPosts(SearchResults searchResults) {
Lists.newArrayList(Collections2.transform(
his.searchManager.convertToEntities(searchResults,
SearchManager.EntityVersionPolicy.LATEST_VERSION), new Function() {
public ContentEntityObject apply(Searchable searchable) {
return (ContentEntityObject) searchable;
}
}));
}
但是放到Eclipse裡會有些部分有紅線如下:
findBlogPosts(SearchResults searchResults)
2 quick fixes available:
Add return statement => 變成 return Lists.newArrayList(Collections2...
Change return type to 'void'
new Function() {
1 quick fix available:
Add unimplemented methods => 變成增加如下片段:
@Override
public Object apply(Object input) {
return null;
}
不確定是不是解譯有錯,Java有method裡面還可以new Function() {....}這種語法嗎
這是Lambda?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.124.165.65
※ 文章網址: https://www.ptt.cc/bbs/java/M.1450848933.A.345.html
→
12/23 14:48, , 1F
12/23 14:48, 1F
→
12/23 16:55, , 2F
12/23 16:55, 2F
→
12/23 16:56, , 3F
12/23 16:56, 3F
→
12/23 16:58, , 4F
12/23 16:58, 4F
→
12/23 16:59, , 5F
12/23 16:59, 5F
推
12/23 19:30, , 6F
12/23 19:30, 6F
推
12/23 21:00, , 7F
12/23 21:00, 7F
→
12/23 21:01, , 8F
12/23 21:01, 8F
→
12/23 21:03, , 9F
12/23 21:03, 9F
→
12/24 11:16, , 10F
12/24 11:16, 10F
→
12/24 11:16, , 11F
12/24 11:16, 11F
→
12/24 11:16, , 12F
12/24 11:16, 12F
→
12/24 11:18, , 13F
12/24 11:18, 13F
→
12/24 11:22, , 14F
12/24 11:22, 14F
→
12/24 11:22, , 15F
12/24 11:22, 15F
推
12/25 00:21, , 16F
12/25 00:21, 16F
→
12/25 00:21, , 17F
12/25 00:21, 17F
java 近期熱門文章
PTT數位生活區 即時熱門文章