私はEmployeeという名前のpojoを持っています。今私は地図上に配置したいユーザー定義のコレクションを作成したいと思います。これを達成する方法を教えてください。ユーザー定義マップの作成
public class Employee {
String name,job;
int salary;
public Employee(String n , String j, int t) {
this.name= n;
this.job=j;
this.salary= t;
}
@Override
public int hashCode() {
return name.hashCode()+job.hashCode()+salary;
}
@Override
public boolean equals(Object obj) {
Employee e = (Employee) obj;
return this.name.equals(e.name) && this.job.equals(e.job)
&& this.salary == e.salary;
}
}
ここでは、実装のための[7]と[8] [ここ](http://java.sun.com/developer/Books/effectivejava/Chapter3.pdf)を参照してください。等しいとハッシュコード – luketorjussen