TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Java 8 and lambdas: ooooh that's how it works, then

19 点作者 julsimon大约 10 年前

8 条评论

wasyl大约 10 年前
I honestly expected some insight into internals of Java 8 lambdas or, for example, how `retrolambda` works. Unfortunately this is only introduction to lambdas in general (and I'm pretty surprised many haven't even heard of lambdas before)
dastbe大约 10 年前
There&#x27;s a lot that could be said about this code, but the worst is that it has an incorrectly implemented swap when one exists in the standard collections library. I don&#x27;t understand why you would show off a feature (which admittedly has an some poor interactions with other aspects of the language) while simultaneously neglecting the standard library and all the language improvements that happened between 1 and 8.<p>Java doesn&#x27;t need anymore disservices.
julsimon大约 10 年前
Thanks for your comments, guys. Yes, I did push the verbosity setting to the max to underline my point. Unfortunately, there is lot of naive, bloated Java code out there (often much worse than this!) and some of us have to fix it for a living. I&#x27;ll try to add an abstract singleton proxy bean factory next time :D
评论 #9286689 未加载
pavlov大约 10 年前
This same article and same code example could have been written in 1975 -- &quot;I just figured out how to use function pointers in C...&quot;<p>Even &quot;object orientation&quot; had already been invented back then, but I assume no one could have imagined that it would be perverted into a chronic bulimia of superfluous types as demonstrated by the &quot;LinearSearchModeFactory&quot; example here.
评论 #9286643 未加载
mobiuscog大约 10 年前
How is this really an improvement over 1 class, with a single method that takes an Enum &#x27;mode&#x27;, which then switches to one of three internal methods ?<p>Lambdas may have some benefits, but this article really doesn&#x27;t demonstrate any.
Camillo大约 10 年前
Why does the &quot;canonical&quot; Java solution involve a factory, anyway?
评论 #9286607 未加载
fmela大约 10 年前
Don&#x27;t use list.get() in a loop; that&#x27;s quadratic for a linked list implementation.
sk5t大约 10 年前
Too much boilerplate list manipulation here, to be honest.