我有一个Map<String, Employee>
和Map<String, Double>
。我想要Map<Employee, Double>
具有相同键的键。例如
Employee emp1 = new Employee("bla1");
Employee emp2 = new Employee("bla2");
Map<String,Employee> nameEmployee = new HashMap<>();
nameEmployee.put("emp1", emp1 );
nameEmployee.put("emp2", emp2 );
Map<String,Double> nameSalary = new HashMap<>();
nameSalary.put("emp1", 1D);
nameSalary.put("emp2", 2D);
预期输出:
Map<Employee,Double> --> [emp1:1D, emp2:2D]