16 Jul 2004 12:18
Re: DeveloperWorks Article: Use closures and higher order functions to write modular Java code
On 16 Jul 2004, at 08:44, John Wilson wrote: > On 16 Jul 2004, at 07:03, jastrachan@... wrote: > >> I blogged about this yesterday to show how verbose doing functors & >> closures in Java is compared to other languages... >> >> http://tinyurl.com/3rmeu >> >> > > Your solution's a bit wordy, James :)) > > isEligibleForDiscount = { (it.category == "A" && it.price > 200) ? > 'is' : 'is not'} > println "Item #1 ${isEligibleForDiscount(item1)} eligible for > discount!" :) James ------- http://radio.weblogs.com/0112098/
RSS Feed