java8/Java8InAction

有些方法找不到 Some method is undefined

KitGavinx opened this issue · 6 comments

class: lambdasinaction.chap10.OperationsWithOptional
line 15 and line 18
The method or(() -> {}) is undefined for the type Optional


class: lambdasinaction.chap10.OptionalMain
line 21
The method flatMap(Function<? super Optional,? extends Stream<? extends R>>) in the type Stream<Optional> is not applicable for the arguments (Optional::stream)


class: lambdasinaction.chap6.Grouping
line 36
The method flatMapping(( dish) -> {}, toSet()) is undefined for the type Grouping

line 41
The method filtering(( dish) -> {}, toList()) is undefined for the type Grouping


class: lambdasinaction.chap6.PartitionPrimeNumbers
line 36
The method takeWhile(( i) -> {}) is undefined for the type Stream

I meet the same problems. The readme.md said this project should be based on JAVA 1.8, but actually the takeWhile is a new function for JAVA 1.9, and also source and target in the pom.xml are also 1.9, so i'm a little confused which java version should i use to run this project?

xerZV commented

@manaatmoon I've used Java 11.

MABIY commented

pom.xml compile plugin source and target all 1.9 , but the project of java8.

I meet the same problems ,too

any solution i am also facing same problem when giving 1.8

java11 is ok