Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: assign lambda to functional interface Date: Sun, 12 May 2019 10:22:12 -0400 Organization: A noiseless patient Spider Lines: 23 Message-ID: References: <6594e2c1-ec44-4cbc-b6fb-2c8a852fa7dd@googlegroups.com> <063ded09-67e2-4750-ad8f-7fd00a210861@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 12 May 2019 14:22:14 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="7273314d492985844ac8ab812cac042c"; logging-data="22988"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+LSpH/TAJnNhVbTbXh2uDC" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Cancel-Lock: sha1:kJychiXQ/Q1X2HOXhwcMDygvI0c= In-Reply-To: <063ded09-67e2-4750-ad8f-7fd00a210861@googlegroups.com> Content-Language: en-US Xref: csiph.com comp.lang.java.programmer:38962 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.