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


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

Re: Why is that in JDK8: value used in lambda expression shuld be effectively final?

X-Received by 10.224.190.193 with SMTP id dj1mr26520889qab.6.1357176930715; Wed, 02 Jan 2013 17:35:30 -0800 (PST)
Received by 10.49.58.238 with SMTP id u14mr7575148qeq.13.1357176930681; Wed, 02 Jan 2013 17:35:30 -0800 (PST)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!ee4no12352722qab.0!news-out.google.com!k2ni4226qap.0!nntp.google.com!ee4no12472729qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Wed, 2 Jan 2013 17:35:30 -0800 (PST)
In-Reply-To <odmer9-onl.ln1@s.simpson148.btinternet.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
NNTP-Posting-Host 69.28.149.29
References <c885bedb-977c-49b4-a10a-b9cdd3df1dd9@googlegroups.com> <m0sdr9-0tg.ln1@s.simpson148.btinternet.com> <9f030e71-96ab-4ead-9690-4369f4a19aa9@googlegroups.com> <pk7er9-i4j.ln1@s.simpson148.btinternet.com> <d6fdb884-3181-4b37-a011-6da19e649758@googlegroups.com> <odmer9-onl.ln1@s.simpson148.btinternet.com>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <c7096f43-e21f-40d3-9b86-bc7915eda212@googlegroups.com> (permalink)
Subject Re: Why is that in JDK8: value used in lambda expression shuld be effectively final?
From Lew <lewbloch@gmail.com>
Injection-Date Thu, 03 Jan 2013 01:35:30 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.java.programmer:20893

Show key headers only | View raw


Steven Simpson wrote:
> Saxo wrote:
>>> int sum = ints.reduce(0, (x, y) -> x + y);
> 
>> Nice, but it does not compile with me. I use IDEA 12 and the 
>> lambda-8-b69-windows-i586-17_dec_2012 JDK. Seems like reduce does not exist in 
>> Iterator or Collection!?
> 
> I figured, if forEach is on Collection, reduce likely would be too. I 

'forEach' is not on Collection. It's on Collection's parent type.

> did try to have a look for it in source, but wasn't sure if I had the 
> right branch.  I also didn't find the javadoc on-line.  Based on the 
> source, try:

Javadoc for Java 8 is on line:
http://download.java.net/jdk8/docs/api/index.html

Not hard to find, but it doesn't contain the information you wanted.


>    ints.stream().reduce(0, (x, y) -> x + y)

http://datumedge.blogspot.com/2012/06/java-8-lambdas.html
gives a brief overview.

-- 
Lew

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


Thread

Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? jeti789@web.de - 2013-01-02 07:08 -0800
  Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? jeti789@web.de - 2013-01-02 07:52 -0800
  Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Steven Simpson <ss@domain.invalid> - 2013-01-02 17:33 +0000
    Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Saxo <jeti789@web.de> - 2013-01-02 11:31 -0800
      Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Lew <lewbloch@gmail.com> - 2013-01-02 12:52 -0800
        Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-02 20:58 -0400
          Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Lew <lewbloch@gmail.com> - 2013-01-02 17:40 -0800
            Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-03 20:43 -0400
        Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Saxo <jeti789@web.de> - 2013-01-02 23:44 -0800
          Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Patricia Shanahan <pats@acm.org> - 2013-01-03 07:57 -0800
            Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Lew <lewbloch@gmail.com> - 2013-01-03 13:22 -0800
              Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Patricia Shanahan <pats@acm.org> - 2013-01-03 16:14 -0800
      Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Steven Simpson <ss@domain.invalid> - 2013-01-02 21:46 +0000
        Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Lew <lewbloch@gmail.com> - 2013-01-02 17:35 -0800
        Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Saxo <jeti789@web.de> - 2013-01-03 02:13 -0800
          Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Saxo <jeti789@web.de> - 2013-01-03 06:45 -0800
            Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Steven Simpson <ss@domain.invalid> - 2013-01-04 21:32 +0000
              Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-04 14:38 -0800
                Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Steven Simpson <ss@domain.invalid> - 2013-01-04 23:45 +0000
                Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-04 17:24 -0800
                Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Steven Simpson <ss@domain.invalid> - 2013-01-05 13:20 +0000
              Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Saxo <jeti789@web.de> - 2013-01-05 01:50 -0800
                Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Steven Simpson <ss@domain.invalid> - 2013-01-05 11:21 +0000
                Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Saxo <jeti789@web.de> - 2013-01-05 04:27 -0800
                Re: Why is that in JDK8: value used in lambda expression shuld be effectively final? Steven Simpson <ss@domain.invalid> - 2013-01-05 12:58 +0000

csiph-web