Accepted answer

i will be answering my own question by providing some updates: i contacted the author who suggested i try the java compiler, not eclipse's: building with ant (and hence using the jdk javac compiler) compiles just fine, and the application runs.

when i looked at the status of java 8 support in eclipse, it seems there are many things to be resolved :

as @jewelsea pointed, intellij idea shows the error but will compile and execute (i assume it uses the jdk-provided javac).

so the answer is : wait for upcoming updates to eclipse and/or the jdk. this specific case is easy to work-around.

and the real issue is that maptoobj provides a stream<object>, and the loop will pass object to the ::add which expects nodeinstances (as rectangle are).


i have hit the same issue. this must be some kind of bug with type inference in the eclipse compiler. i found that it also compiles when manually extracting the function within maptoobj:

private void populatecells(group root, final spriteview.mary mary) {
    intfunction<stream<rectangle>> mapper = i -> intstream.range(0,
                    j -> {
                        rectangle rect = new rectangle(i * cell_size, j
                                * cell_size, cell_size, cell_size);
                        rect.setfill(color.rgb(0, 0, 0, 0));
                        rect.setonmousepressed(e -> mary
                                .moveto(new location(i, j)));
                        return rect;
    // gratuitous use of lambdas to do nested iteration!
    group cells = new group();
    intstream.range(0, horizontal_cells).maptoobj(mapper).flatmap(s -> s)


Related Query

More Query from same tag