Interviewer question in one of my interviews.
We have
Employeeclass withid,firstName, andlastNamefields and getters and setters of these fields. We do not have source code of this class, it is in JAR. We are usingEmployeeinstances as the key inTreeMap. Now we want to sort thisTreeMapbased on theEmployeeidfield.
I know we can use Comparable interface to sort but how can we use it if we do not have the source code?
 
     
    