Home > Back-end >  The project with eclipse jre into 1.8 error
The project with eclipse jre into 1.8 error

Time:11-26

Follow the teacher write lamdba way to traverse the collection, need 1.8 later, I changed the jre to 1.8 elsewhere is wrong, have to change to 1.7, this is the solution? To solve the thank you

CodePudding user response:

The function of the foreach is 1.8
Seen from your figure, you give project loaded two jre, 1.8 and jdk7, remove jdk7 jre is not an error

CodePudding user response:

reference 1st floor tianfang response:
foreach is 1.8 features,
Seen from your figure, you give project loaded two jre, 1.8 and jdk7, remove jdk7 jre is not an error

The method can remove jdk7, other packages error

CodePudding user response:

refer to the second floor heart sweet heart you reply opportunely:
Quote: refer to 1st floor tianfang response:
foreach is 1.8 features,
Seen from your figure, you give project loaded two jre, 1.8 and jdk7, remove jdk7 jre is not an error

The method can remove jdk7, other packages error


Now also in Java 7? Later, there will be a lot of pit java8 directly

CodePudding user response:

You right in your project, in the project and the JDK version of the module are changed to 1.8, is backwards compatible JDK

CodePudding user response:

Right-clicking on the project: build path & gt; Configure Build Path

CodePudding user response:

What the teacher in perpetuated this misunderstanding
 
@ Test
Public void testA () {
Stream Rs=Stream of (new Student (1 l, "xiaofanku", 40), the new Student (2 l, "cherry", 24), a new Student (3 l, "xiaomi", 34));

Rs. Collect (Collectors. ToMap (Student: : getName, Student: : getAge)). The forEach ((k, v) - & gt; {
System. The out. Println (" Name: "", the Age:" + v +, k +);
});
}
  • Related