Forums Register Login

Lambda / predicate

+Pie Number of slices to send: Send


Hi folks, above is a perfectly working code. However, I would like to know how does one write the line "check(animalList, a -> a.isPurrer());" with full lambda signature (signature blueprint is like this: (Animal a) -> { return a.canHop(); } ).
And one more question, how often are lambdas and predicates used in a real life coding?
Thanks in advance!
1
+Pie Number of slices to send: Send
Have you seen the details of the Stream#filter() method, the Predicate interface and the appropriate part of the Java™ Tutorials about nested classes? You might only need the last link.
You end up with something like
1
+Pie Number of slices to send: Send
You can probably condense that Predicate to a method reference.
We don't have time for this. We've gotta save the moon! Or check this out:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 619 times.
Similar Threads
Functional Interface
Array / Array list
Wildcards and Method References
ArrayList and Subclass Methods
Generics Doubt in for loop
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:43:05.