The "import java.util.function cannot be resolved" error

i solved this problem by trying following solution

Project > Properties > Java Build Path
Select Libraries tab
Select JRE System Library
Click Edit button
Choose an alternate JRE (jre1.8.0_20)
Click Finish button


Per the java.util.function Javadoc,

Since:
      1.8

So upgrade to Java 8, or try to find an older version of the tutorial.

I'm new at this. How can you tell what you are running? I'm using Eclipse

To determine your current Java version in eclipse, go to

Help -> About Eclipse -> Installation Details (Button in
          lower Left) -> Configuration pane

Look for the line java.specification.version - on my machine that is

java.specification.version=1.8

Or the line java.runtime.version - on my machine that is

java.runtime.version=1.8.0_11-b12

Lambda Expressions are newly added into Java 8. They are not available for JRE7. Try to upgrade your eclipse project's JRE to 8 (window -> preferences->java->compiler).