title: How can I sort Employee Objects using enum constants?
body: <p>I am new with Stream API, Lambdas and Enums, How can I use enums to sort my list BYNAME, BYSALARY?</p>
  
  <pre><code>import java.util.*;
  import java.util.function.*;
  import java.util.stream.Stream;
  
  class Employee {
      String name;
      int salary;
  
      Employee(String name,int salary) {
          this.name = name;
          this.salary = salary;
      }
      public String getName() {
          return this.name;
      }
      public int getSalary() {
          return this.salary;
      }
      public void setName(String name) {
          this.name = name;
      }
      public void setSalary(int salary) {
          this.salary = salary;
      }
  }
  
  class EmployeeInfo {
      enum SortMethod {
          BYNAME,BYSALARY;
          //Do I have to do something here?
      };
  
      public List&lt;Employee&gt; sort(List&lt;Employee&gt; emps,final SortMethod method) {
          //What I have to Write here?
      }
  }
  </code></pre>
  
  <p>I have to define sort method to return my list by using enum.</p>