title: Java Function chaining
body: <p>I'm trying to work out why the following code fails to compile:</p>
  
  <pre><code>Function&lt;Employee, String&gt; getLastName = (Employee employee) -&gt; {
      return employee.getName().substring(employee.getName().indexOf(" ") + 1);
  };
  
  Function&lt;Employee, String&gt; getFirstName = (Employee employee) -&gt; {
      return employee.getName().substring(0, employee.getName().indexOf(" "));
  };
  
  Function chained = getFirstName.apply(employees.get(2).andThen(getFirstName.apply(employees.get(2)))); 
  </code></pre>
  
  <p>Can't all Functions be cahined in java 8?</p>