Functional Programming with Java 8

The recording of our March 12th webinar featuring Venkat Subramaniam, Functional Programming with Java 8, is now available on JetBrains YouTube Channel.

In this presentation, we discuss how Java 8 now facilitates a functional style of programming and why we should care about it. Using multiple examples, during this live coding session, we will explore the strengths and benefits of the new Java 8 language features.

Learn more about IntelliJ IDEA 13.1 and its support for Java 8.

About the Presenter:

Dr_Venkat_Subramaniam_200x200Dr. Venkat Subramaniam is an award-winning author, founder of Agile Developer, Inc., and an instructional professor at the University of Houston. He has trained and mentored thousands of software developers in the US, Canada, Europe, and Asia, and is a regularly-invited speaker at several international conferences. Venkat helps his clients effectively apply and succeed with agile practices on their software projects.

Venkat is a (co)author of multiple books, including the 2007 Jolt Productivity award winning book Practices of an Agile Developer. His latest book is Functional Programming in Java: Harnessing the Power of Java 8 Lambda Expressions. You can reach him by email at venkats@agiledeveloper.com or on Twitter at @venkat_s.

This entry was posted in Webinars. Bookmark the permalink.

6 Responses to Functional Programming with Java 8

  1. Ramesh says:

    Awesome session. Thanks a lot venkat and. Jetbrains

  2. Gernot Starke says:

    A slight issue with your Predicate…

    The pure-lambda version of “isPrime” works like a charm:

    protected boolean isPrime(final int number) {

    return number > 1 &&
    IntStream.range(2, number)
    .noneMatch(index -> number % index == 0);
    }

    But the Predicate-version does not compile:

    Boolean doesNotWork =
    number > 1 &&
    IntStream.range(2, number)
    .noneMatch( index -> isDivisible(index));

    The right-hand-side of the latter lambda expects a method… not a Predicate.

    Otherwise – a great intro, especially your explanation of “intent”

    • Andrey Cheptsov says:

      >> expects a method

      Sorry but didn’t get what you mean. noneMatch expects IntPredicate in this particular case.

  3. Philip Herbst says:

    Hi, I think the problem with the predicate version is that the IntStream needs a special primitive predicate type, because primitives don’t work with generics.

    This works
    {code}
    IntPredicate isDivisible = divisor -> number % divisor == 0;
    return number > 1 && range(2, number).noneMatch(isDivisible);
    {code}

    By the way if you use IntelliJ refactoring “extract method” on the code snippet the ide infers the right type
    {code}
    index -> number % index == 0
    {code}

  4. Andy Heilveil says:

    Nitpicking: I see no lazy reduction of work done in the example of “doubling the first even number less than 3″. IE the same number of compares is done in the for-loop implementation. Nothing is gained performance wise. I’d agree that being able to assign a value via a for-loop is syntactically convenient.
    The internal lazy implementation of the stream class operators keeps the stream version from performing wastefully, but is not a performance improvement over a for loop.

  5. Pingback: Annotated Java Monthly, April 2014 | JetBrains IntelliJ IDEA Blog

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">