Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!goblin2!goblin3!goblin.stu.neva.ru!news.netfront.net!not-for-mail From: Wanja Gayk Newsgroups: comp.lang.java.programmer Subject: Re: are lambdas a way to bring functional programming to java? Date: Wed, 2 Jul 2014 20:52:02 +0200 Organization: Netfront http://www.netfront.net/ Lines: 31 Message-ID: References: <53ae08d5$0$304$14726298@news.sunsite.dk> <53ae0af4$0$302$14726298@news.sunsite.dk> NNTP-Posting-Host: 77.8.105.242 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: adenine.netfront.net 1404327096 92035 77.8.105.242 (2 Jul 2014 18:51:36 GMT) X-Complaints-To: news@netfront.net NNTP-Posting-Date: Wed, 2 Jul 2014 18:51:36 +0000 (UTC) User-Agent: MicroPlanet-Gravity/3.0.4 Xref: csiph.com comp.lang.java.programmer:28913 In article , markspace (markspace@nospam.nospam) says... > > On 6/28/2014 5:43 AM, Wanja Gayk wrote: > > > > static final Comparator COMPARE_BY_LENGTH > > = (s1,s2) -> s1.length() - s2.length() > > > > Collections.sort(lst, COMPARE_BY_LENGTH); > > In that video you just posted featuring Brian Goetz talking about > lambdas, Mr. Goetz says this is a bad idea. This costs a static field > and the time it takes to initialize the field during startup. And you > may never use that field, so you just spent time initializing unnecessarily. I don't care for some few bytes and nanoseconds wasted, if not wasting them means "bad to read" and "bad to reuse". If my profiler tells me that this little extra causes a problem, then I'd be happy to go another route, until them I'm happy to waste some on maintainance costs that usually trump runtime costs my a large margin. Kind regards, Wanja -- ..Alesi's problem was that the back of the car was jumping up and down dangerously - and I can assure you from having been teammate to Jean Alesi and knowing what kind of cars that he can pull up with, when Jean Alesi says that a car is dangerous - it is. [Jonathan Palmer] --- news://freenews.netfront.net/ - complaints: news@netfront.net ---