title: returning map of employeeName and average salary of all his managers in java 8
body: <p>I have been trying to find out some way to &quot;return average salary of all the managers of an employee mapped with employee Name for a given employeeList &quot;. I have achieved this is java 7 .However I am unable to achieve this is java 8.
  Below is my Manager class,Employee class and method &quot;Map&lt;String,Double&gt;  getAverageSalary&quot; .Please help me to do this in java 8.</p>
  <pre><code>    public class Manager {
          private String name;
      private double salary;
      
      public double getSalary() {
          return salary;
      }
      
      public void setSalary(double salary) {
          this.salary = salary;
      }
      
      public String getName() {
          return name;
      }
      
      public void setName(String name) {
          this.name = name;
      }
      }
  
  **Employee class and the method** :
  
      public class Employee {
      private String eName;
          private List&lt;Manager&gt; managers;
          public String geteName() {
              return eName;
          }
          public void seteName(String eName) {
              this.eName = eName;
          }
          public List&lt;Manager&gt; getManagers() {
              return managers;
          }
          public void setManagers(List&lt;Manager&gt; managers) {
              this.managers = managers;
          }
          
          public Map&lt;String,Double&gt;  getAverageSalary(List&lt;Employee&gt; empList){
              double sum=0.0;
              double avg=0.0;
              Map&lt;String ,Double&gt; avaerageSalary=new HashMap&lt;String,Double&gt;();
              for(Employee emp:empList) {
                  
                  for(Manager mg:emp.getManagers()) {
                      sum=sum+mg.getSalary();
                  }
                  avg=sum/emp.getManagers().size();
                  avaerageSalary.put(emp.eName, avg);
              }
              
              
              return avaerageSalary;
          }
          
      }
  
  Also suggest me good sources to become proficient in java 8 syntax.
  </code></pre>