title: syntax of lambda functions in java 8
body: <p>I am new to java, and I do not know how to write a simple lambda function. I tried to read some articles, like <a href="http://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html" rel="nofollow">this one</a>, but I do not manage to compile, as I get error of syntax.</p>
  
  <p>I wish to replace the function <code>F</code> is in this code with a <code>λ-function</code></p>
  
  <pre><code>class Test {
    private int N;
    public Test (int n) {
        N = n;
    }
  
    private int f (int x) {                   /* &lt;== replace this */
        return 2*x;
    }
  
    public void print_f () {
        for (int i = 0; i &lt; this.N; i++)
            System.out.println (f(i));        /* &lt;== with lambda here*/
    }
  
    public static void main (String[] args) {
        int n = 10;
        if (args.length == 1)
            n = Integer.parseInt(args[0]);
        Test t = new Test (n);
        t.print_f ();
    }
  }
  </code></pre>
  
  <p><strong>EDIT</strong>: My question concerns <strong><em>only the syntax</em></strong> of <em>λ-functions</em> in Java. Not the syntax of anonymous classes.</p>