Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #38962

Re: assign lambda to functional interface

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: assign lambda to functional interface
Date 2019-05-12 10:22 -0400
Organization A noiseless patient Spider
Message-ID <qb9a6m$mec$1@dont-email.me> (permalink)
References <6594e2c1-ec44-4cbc-b6fb-2c8a852fa7dd@googlegroups.com> <063ded09-67e2-4750-ad8f-7fd00a210861@googlegroups.com>

Show all headers | View raw


On 5/12/2019 9:28 AM, gk wrote:
> 
> Does lambda expression always have to return boolean ?  or lambda can return anything ?
> most example shows boolean return by lambda expression.

     A lambda expression can be of any type, including void.

     Your questions about lambdas are rather elementary, and suggest
that you've picked up some incomplete or even erroneous information
about them.  I strongly suggest you engage in some study on your own
before going much further.  A good place to start is

https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html

     There you will find many examples  of lambdas that yield booleans,
but also of lambdas that yield other types and of void lambdas.

     ... and if the Tutorial leaves something unanswered, many of your
questions can be resolved with the Try It For Yourself algorithm ...

-- 
esosman@comcast-dot-net.invalid
Six hundred nineteen days to go.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

assign lambda to functional interface gk <srcjnu@gmail.com> - 2019-05-10 21:58 -0700
  Re: assign lambda to functional interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-05-11 06:31 -0400
    Re: assign lambda to functional interface gk <srcjnu@gmail.com> - 2019-05-11 05:57 -0700
      Re: assign lambda to functional interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-05-11 09:38 -0400
  Re: assign lambda to functional interface gk <srcjnu@gmail.com> - 2019-05-12 06:28 -0700
    Re: assign lambda to functional interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-05-12 10:22 -0400

csiph-web