Predicates? (original) (raw)

Jason Schroeder shrode at subnature.com
Thu Apr 18 12:28:10 PDT 2013


Would these make good class comments for the class Predicates? see Objects plus a few choice others, ()->false is fine, etc.

I know it won't help programming-by-autocomplete "where is X?" Those of us used to adding "p" to function names see predicates everywhere. But autocomplete and static accesses mean the lambda-newbie needs a nudge to see predicates everywhere too.

On Thu, Apr 18, 2013 at 1:12 PM, Brian Goetz <brian.goetz at oracle.com> wrote:

We actually have one which we're considering getting rid of :)

The ones you outline are fairly low-value; they make tons of sense in a world when inner classes are your only tool, but () -> false is more compact and more efficient and just as clear as Predicates.alwaysFalse() So our approach is to mostly avoid such trivial conveniences. On 4/18/2013 2:38 PM, Michael Nascimento wrote: > Hi folks, > > Have you already considered a Predicates class / static methods in > Predicate with useful methods such as alwaysTrue(), alwaysFalse(), > isNull() etc? > > Something like Predicates in Guava: > > http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/base/Predicates.html > > Regards, > Michael >



More information about the lambda-dev mailing list